diff mbox series

[-next] power: supply: axp288_charger: Fix missing mutex_init()

Message ID 20211013093115.2841167-1-weiyongjun1@huawei.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [-next] power: supply: axp288_charger: Fix missing mutex_init() | expand

Commit Message

Wei Yongjun Oct. 13, 2021, 9:31 a.m. UTC
The driver allocates the mutex but not initialize it.
Use mutex_init() on it to initialize it correctly.

Fixes: ed229454856e ("power: supply: axp288-charger: Optimize register reading method")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/power/supply/axp288_charger.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Hans de Goede Oct. 13, 2021, 11:49 a.m. UTC | #1
Hi,

On 10/13/21 11:31 AM, Wei Yongjun wrote:
> The driver allocates the mutex but not initialize it.
> Use mutex_init() on it to initialize it correctly.
> 
> Fixes: ed229454856e ("power: supply: axp288-charger: Optimize register reading method")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Thanks, patch looks good to me
(I should have catched this myself during review...) :

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>  drivers/power/supply/axp288_charger.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> index fd4983c98fd9..9987b1731e38 100644
> --- a/drivers/power/supply/axp288_charger.c
> +++ b/drivers/power/supply/axp288_charger.c
> @@ -865,6 +865,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
>  	if (!info)
>  		return -ENOMEM;
>  
> +	mutex_init(&info->lock);
>  	info->pdev = pdev;
>  	info->regmap = axp20x->regmap;
>  	info->regmap_irqc = axp20x->regmap_irqc;
>
Sebastian Reichel Oct. 13, 2021, 1:33 p.m. UTC | #2
Hi,

On Wed, Oct 13, 2021 at 01:49:19PM +0200, Hans de Goede wrote:
> On 10/13/21 11:31 AM, Wei Yongjun wrote:
> > The driver allocates the mutex but not initialize it.
> > Use mutex_init() on it to initialize it correctly.
> > 
> > Fixes: ed229454856e ("power: supply: axp288-charger: Optimize register reading method")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Thanks, patch looks good to me
> (I should have catched this myself during review...) :
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Thanks, queued.

-- Sebastian

> > ---
> >  drivers/power/supply/axp288_charger.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
> > index fd4983c98fd9..9987b1731e38 100644
> > --- a/drivers/power/supply/axp288_charger.c
> > +++ b/drivers/power/supply/axp288_charger.c
> > @@ -865,6 +865,7 @@ static int axp288_charger_probe(struct platform_device *pdev)
> >  	if (!info)
> >  		return -ENOMEM;
> >  
> > +	mutex_init(&info->lock);
> >  	info->pdev = pdev;
> >  	info->regmap = axp20x->regmap;
> >  	info->regmap_irqc = axp20x->regmap_irqc;
> > 
>
diff mbox series

Patch

diff --git a/drivers/power/supply/axp288_charger.c b/drivers/power/supply/axp288_charger.c
index fd4983c98fd9..9987b1731e38 100644
--- a/drivers/power/supply/axp288_charger.c
+++ b/drivers/power/supply/axp288_charger.c
@@ -865,6 +865,7 @@  static int axp288_charger_probe(struct platform_device *pdev)
 	if (!info)
 		return -ENOMEM;
 
+	mutex_init(&info->lock);
 	info->pdev = pdev;
 	info->regmap = axp20x->regmap;
 	info->regmap_irqc = axp20x->regmap_irqc;