diff mbox series

power: supply_core: fix noderef.cocci warnings

Message ID 20220117014158.GA3685@07889aeafbfc (mailing list archive)
State New, archived
Headers show
Series power: supply_core: fix noderef.cocci warnings | expand

Commit Message

kernel test robot Jan. 17, 2022, 1:41 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>
---

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(-)
diff mbox series

Patch

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