diff mbox series

power: supply: cw2015: Fix application of sizeof to pointer

Message ID a45647609e9d87e8fee643920b1479492956df2a.1644837424.git.yang.guang5@zte.com.cn
State New
Headers show
Series power: supply: cw2015: Fix application of sizeof to pointer | expand

Commit Message

David Yang Feb. 15, 2022, 12:53 a.m. UTC
From: Yang Guang <yang.guang5@zte.com.cn>

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 <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 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..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;