DORMANTno replies

[PATCH] power: supply: cw2015: Fix application of sizeof to pointer

From: <hidden>
Date: 2022-02-15 00:53:59
Also in: lkml
Subsystem: cellwise cw2015 battery driver, power supply class/subsystem and drivers, the rest · Maintainers: Tobias Schrammm, Sebastian Reichel, Linus Torvalds

From: Yang Guang <redacted>

The coccinelle check report:
./drivers/power/supply/cw2015_battery.c:692:12-18:
ERROR: application of sizeof to pointer

Using the real size to fix it.

Reported-by: Zeal Robot <redacted>
Signed-off-by: Yang Guang <redacted>
Signed-off-by: David Yang <redacted>
---
 drivers/power/supply/cw2015_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c
index 0c87ad0dbf71..db56db322b64 100644
--- a/drivers/power/supply/cw2015_battery.c
+++ b/drivers/power/supply/cw2015_battery.c
@@ -689,7 +689,7 @@ static int cw_bat_probe(struct i2c_client *client)
 	if (ret) {
 		/* Allocate an empty battery */
 		cw_bat->battery = devm_kzalloc(&client->dev,
-					       sizeof(cw_bat->battery),
+					       sizeof(*(cw_bat->battery)),
 					       GFP_KERNEL);
 		if (!cw_bat->battery)
 			return -ENOMEM;
-- 
2.30.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help