LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: Fix typo in power_supply_check_supplies
@ 2022-07-05  3:32 Schspa Shi
  2022-07-16 22:47 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Schspa Shi @ 2022-07-05  3:32 UTC (permalink / raw
  To: myungjoo.ham, sre; +Cc: linux-pm, linux-kernel, Schspa Shi

It seems to be a typo, there is no actual BUG, but it's better to
fix it to avoid any possible BUG after we change the type of
supplied_from.

Signed-off-by: Schspa Shi <schspa@gmail.com>
---
 drivers/power/supply/power_supply_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index fad5890c899e..02228d68c599 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -263,13 +263,13 @@ static int power_supply_check_supplies(struct power_supply *psy)
 		return 0;
 
 	/* All supplies found, allocate char ** array for filling */
-	psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(psy->supplied_from),
+	psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(*psy->supplied_from),
 					  GFP_KERNEL);
 	if (!psy->supplied_from)
 		return -ENOMEM;
 
 	*psy->supplied_from = devm_kcalloc(&psy->dev,
-					   cnt - 1, sizeof(char *),
+					   cnt - 1, sizeof(**psy->supplied_from),
 					   GFP_KERNEL);
 	if (!*psy->supplied_from)
 		return -ENOMEM;
-- 
2.29.0


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

* Re: [PATCH] power: supply: Fix typo in power_supply_check_supplies
  2022-07-05  3:32 [PATCH] power: supply: Fix typo in power_supply_check_supplies Schspa Shi
@ 2022-07-16 22:47 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2022-07-16 22:47 UTC (permalink / raw
  To: Schspa Shi; +Cc: myungjoo.ham, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1321 bytes --]

Hi,

On Tue, Jul 05, 2022 at 11:32:44AM +0800, Schspa Shi wrote:
> It seems to be a typo, there is no actual BUG, but it's better to
> fix it to avoid any possible BUG after we change the type of
> supplied_from.
> 
> Signed-off-by: Schspa Shi <schspa@gmail.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/power_supply_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
> index fad5890c899e..02228d68c599 100644
> --- a/drivers/power/supply/power_supply_core.c
> +++ b/drivers/power/supply/power_supply_core.c
> @@ -263,13 +263,13 @@ static int power_supply_check_supplies(struct power_supply *psy)
>  		return 0;
>  
>  	/* All supplies found, allocate char ** array for filling */
> -	psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(psy->supplied_from),
> +	psy->supplied_from = devm_kzalloc(&psy->dev, sizeof(*psy->supplied_from),
>  					  GFP_KERNEL);
>  	if (!psy->supplied_from)
>  		return -ENOMEM;
>  
>  	*psy->supplied_from = devm_kcalloc(&psy->dev,
> -					   cnt - 1, sizeof(char *),
> +					   cnt - 1, sizeof(**psy->supplied_from),
>  					   GFP_KERNEL);
>  	if (!*psy->supplied_from)
>  		return -ENOMEM;
> -- 
> 2.29.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2022-07-16 22:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-05  3:32 [PATCH] power: supply: Fix typo in power_supply_check_supplies Schspa Shi
2022-07-16 22:47 ` Sebastian Reichel

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 read-only IMAP folder(s) and NNTP newsgroup(s).