linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] power: supply_core: fix application of sizeof to pointer
@ 2022-01-05  2:37 Yang Li
  2022-01-12  0:42 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2022-01-05  2:37 UTC (permalink / raw)
  To: t.schramm
  Cc: sre, linus.walleij, linux-pm, linux-kernel, Yang Li, Abaci Robot

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

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Fixes: 25fd330370ac ("power: supply_core: Pass pointer to battery info")
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 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..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;
-- 
2.20.1.7.g153144c


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] power: supply_core: fix application of sizeof to pointer
  2022-01-05  2:37 [PATCH -next] power: supply_core: fix application of sizeof to pointer Yang Li
@ 2022-01-12  0:42 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2022-01-12  0:42 UTC (permalink / raw)
  To: Yang Li; +Cc: t.schramm, sre, linux-pm, linux-kernel, Abaci Robot

On Wed, Jan 5, 2022 at 3:37 AM Yang Li <yang.lee@linux.alibaba.com> wrote:

> The coccinelle check report:
> ./drivers/power/supply/cw2015_battery.c:692:12-18: ERROR: application of
> sizeof to pointer
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Fixes: 25fd330370ac ("power: supply_core: Pass pointer to battery info")
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thanks for finding this!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-12  0:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05  2:37 [PATCH -next] power: supply_core: fix application of sizeof to pointer Yang Li
2022-01-12  0:42 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).