diff mbox series

power: supply: Fix typo in power_supply_check_supplies

Message ID 20220705033244.5791-1-schspa@gmail.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series power: supply: Fix typo in power_supply_check_supplies | expand

Commit Message

Schspa Shi July 5, 2022, 3:32 a.m. UTC
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(-)

Comments

Sebastian Reichel July 16, 2022, 10:47 p.m. UTC | #1
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
>
diff mbox series

Patch

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;