Subject: [PATCH] power: supply_core: fix noderef.cocci warnings

From: kernel test robot <[email-masked]>
Date: Mon, 17 Jan 2022 09:41:58 +0800

From: kernel test robot <[email-masked]>

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 <[email-masked]>
Signed-off-by: kernel test robot <[email-masked]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-nomadik.git ux500-href-charging-v5.16-rc1
head:   1e846b0b60ac01cac4f283975a1bc395ff73d995
commit: 0839e7a54fc2233ea74b21651d022b981c124f78 [32/58] power: supply_core: Pass pointer to battery info
:::::: branch date: 2 days ago
:::::: commit date: 4 weeks ago

 cw2015_battery.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- 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_clien
 	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;

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel