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

From: davidcomponentone
Date: Mon Feb 14 2022 - 19:53:59 EST


From: Yang Guang <yang.guang5@xxxxxxxxxx>

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@xxxxxxxxxx>
Signed-off-by: Yang Guang <yang.guang5@xxxxxxxxxx>
Signed-off-by: David Yang <davidcomponentone@xxxxxxxxx>
---
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