diff mbox series

power: supply: cw2015: fix noderef.cocci warnings

Message ID 20220130011524.8537-1-linus.walleij@linaro.org
State New
Headers show
Series power: supply: cw2015: fix noderef.cocci warnings | expand

Commit Message

Linus Walleij Jan. 30, 2022, 1:15 a.m. UTC
From: kernel test robot <lkp@intel.com>

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

 sizeof when applied to a pointer typed expression gives the size of
 the pointer

Generated by: scripts/coccinelle/misc/noderef.cocci

Fixes: 0839e7a54fc2 ("power: supply_core: Pass pointer to battery info")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
[Fixed up subject]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/power/supply/cw2015_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/power/supply/cw2015_battery.c b/drivers/power/supply/cw2015_battery.c
index 0c87ad0dbf71..728e2a6cc9c3 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;