[PATCH] extcon: Remove redundant 0 value initialization

Liao Yuanhong posted 1 patch 1 month, 2 weeks ago
drivers/extcon/extcon.c | 1 -
1 file changed, 1 deletion(-)
[PATCH] extcon: Remove redundant 0 value initialization
Posted by Liao Yuanhong 1 month, 2 weeks ago
The extcon_dev struct is already zeroed by kzalloc(). It's redundant to
initialize edev->max_supported to 0.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 drivers/extcon/extcon.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index e7f55c021e56..e6b10dcdb3cb 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -1064,7 +1064,6 @@ struct extcon_dev *extcon_dev_allocate(const unsigned int *supported_cable)
 	if (!edev)
 		return ERR_PTR(-ENOMEM);
 
-	edev->max_supported = 0;
 	edev->supported_cable = supported_cable;
 
 	return edev;
-- 
2.34.1
Re: [PATCH] extcon: Remove redundant 0 value initialization
Posted by Markus Elfring 1 month, 2 weeks ago
> The extcon_dev struct is already zeroed by kzalloc(). It's redundant to
> initialize edev->max_supported to 0.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc2#n94

Regards,
Markus