linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe()
@ 2021-06-03 14:13 Yang Yingliang
  2021-06-03 17:12 ` Guru Das Srinagesh
  0 siblings, 1 reply; 5+ messages in thread
From: Yang Yingliang @ 2021-06-03 14:13 UTC (permalink / raw)
  To: linux-kernel, linux-arm-msm; +Cc: lee.jones, agross, gurus

In case of error, the function devm_regmap_init_i2c() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check
should be replaced with IS_ERR().

Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/mfd/qcom-pm8008.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
index c472d7f8103c..dfefa60d693b 100644
--- a/drivers/mfd/qcom-pm8008.c
+++ b/drivers/mfd/qcom-pm8008.c
@@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)
 	struct pm8008_data *chip;
 
 	chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
-	if (!chip)
+	if (IS_ERR(chip))
 		return -ENOMEM;
 
 	chip->dev = &client->dev;
-- 
2.25.1


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

* Re: [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe()
  2021-06-03 14:13 [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe() Yang Yingliang
@ 2021-06-03 17:12 ` Guru Das Srinagesh
  2021-06-03 17:31   ` Dmitry Baryshkov
  0 siblings, 1 reply; 5+ messages in thread
From: Guru Das Srinagesh @ 2021-06-03 17:12 UTC (permalink / raw)
  To: Yang Yingliang; +Cc: linux-kernel, linux-arm-msm, lee.jones, agross

On Thu, Jun 03, 2021 at 10:13:57PM +0800, Yang Yingliang wrote:
> In case of error, the function devm_regmap_init_i2c() returns ERR_PTR()
> and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>

Acked-by: Guru Das Srinagesh <gurus@codeaurora.org>

> ---
>  drivers/mfd/qcom-pm8008.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
> index c472d7f8103c..dfefa60d693b 100644
> --- a/drivers/mfd/qcom-pm8008.c
> +++ b/drivers/mfd/qcom-pm8008.c
> @@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)
>  	struct pm8008_data *chip;
>  
>  	chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
> -	if (!chip)
> +	if (IS_ERR(chip))
>  		return -ENOMEM;
>  
>  	chip->dev = &client->dev;
> -- 
> 2.25.1
> 

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

* Re: [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe()
  2021-06-03 17:12 ` Guru Das Srinagesh
@ 2021-06-03 17:31   ` Dmitry Baryshkov
  2021-06-03 19:05     ` Guru Das Srinagesh
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Baryshkov @ 2021-06-03 17:31 UTC (permalink / raw)
  To: Guru Das Srinagesh
  Cc: Yang Yingliang, open list,
	open list:DRM DRIVER FOR MSM ADRENO GPU, Lee Jones, Andy Gross

On Thu, 3 Jun 2021 at 20:18, Guru Das Srinagesh <gurus@codeaurora.org> wrote:
>
> On Thu, Jun 03, 2021 at 10:13:57PM +0800, Yang Yingliang wrote:
> > In case of error, the function devm_regmap_init_i2c() returns ERR_PTR()
> > and never returns NULL. The NULL test in the return value check
> > should be replaced with IS_ERR().
> >
> > Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>
> Acked-by: Guru Das Srinagesh <gurus@codeaurora.org>

Interestingly, the change does not correspond to the changelog
message. And the code is correct as devm_kzalloc returns NULL if I
remember correctly.

>
> > ---
> >  drivers/mfd/qcom-pm8008.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
> > index c472d7f8103c..dfefa60d693b 100644
> > --- a/drivers/mfd/qcom-pm8008.c
> > +++ b/drivers/mfd/qcom-pm8008.c
> > @@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)
> >       struct pm8008_data *chip;
> >
> >       chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
> > -     if (!chip)
> > +     if (IS_ERR(chip))
> >               return -ENOMEM;
> >
> >       chip->dev = &client->dev;
> > --
> > 2.25.1
> >



-- 
With best wishes
Dmitry

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

* Re: [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe()
  2021-06-03 17:31   ` Dmitry Baryshkov
@ 2021-06-03 19:05     ` Guru Das Srinagesh
  2021-06-04  1:26       ` Yang Yingliang
  0 siblings, 1 reply; 5+ messages in thread
From: Guru Das Srinagesh @ 2021-06-03 19:05 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Yang Yingliang, open list,
	open list:DRM DRIVER FOR MSM ADRENO GPU, Lee Jones, Andy Gross

On Thu, Jun 03, 2021 at 08:31:28PM +0300, Dmitry Baryshkov wrote:
> On Thu, 3 Jun 2021 at 20:18, Guru Das Srinagesh <gurus@codeaurora.org> wrote:
> >
> > On Thu, Jun 03, 2021 at 10:13:57PM +0800, Yang Yingliang wrote:
> > > In case of error, the function devm_regmap_init_i2c() returns ERR_PTR()
> > > and never returns NULL. The NULL test in the return value check
> > > should be replaced with IS_ERR().
> > >
> > > Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
> > > Reported-by: Hulk Robot <hulkci@huawei.com>
> > > Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> >
> > Acked-by: Guru Das Srinagesh <gurus@codeaurora.org>
> 
> Interestingly, the change does not correspond to the changelog
> message. And the code is correct as devm_kzalloc returns NULL if I
> remember correctly.

Thanks for pointing that out - I missed that. I would like to retract my
Acked-by for this patch.

> 
> >
> > > ---
> > >  drivers/mfd/qcom-pm8008.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
> > > index c472d7f8103c..dfefa60d693b 100644
> > > --- a/drivers/mfd/qcom-pm8008.c
> > > +++ b/drivers/mfd/qcom-pm8008.c
> > > @@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)
> > >       struct pm8008_data *chip;
> > >
> > >       chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
> > > -     if (!chip)
> > > +     if (IS_ERR(chip))
> > >               return -ENOMEM;
> > >
> > >       chip->dev = &client->dev;
> > > --
> > > 2.25.1
> > >
> 
> 
> 
> -- 
> With best wishes
> Dmitry

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

* Re: [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe()
  2021-06-03 19:05     ` Guru Das Srinagesh
@ 2021-06-04  1:26       ` Yang Yingliang
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Yingliang @ 2021-06-04  1:26 UTC (permalink / raw)
  To: Guru Das Srinagesh, Dmitry Baryshkov
  Cc: open list, open list:DRM DRIVER FOR MSM ADRENO GPU, Lee Jones,
	Andy Gross


On 2021/6/4 3:05, Guru Das Srinagesh wrote:
> On Thu, Jun 03, 2021 at 08:31:28PM +0300, Dmitry Baryshkov wrote:
>> On Thu, 3 Jun 2021 at 20:18, Guru Das Srinagesh <gurus@codeaurora.org> wrote:
>>> On Thu, Jun 03, 2021 at 10:13:57PM +0800, Yang Yingliang wrote:
>>>> In case of error, the function devm_regmap_init_i2c() returns ERR_PTR()
>>>> and never returns NULL. The NULL test in the return value check
>>>> should be replaced with IS_ERR().
>>>>
>>>> Fixes: 6b149f3310a4 ("mfd: pm8008: Add driver for QCOM PM8008 PMIC")
>>>> Reported-by: Hulk Robot <hulkci@huawei.com>
>>>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>>> Acked-by: Guru Das Srinagesh <gurus@codeaurora.org>
>> Interestingly, the change does not correspond to the changelog
>> message. And the code is correct as devm_kzalloc returns NULL if I
>> remember correctly.
My bad, I sent a wong patch, I will send a new one.

Thanks,
Yang
> Thanks for pointing that out - I missed that. I would like to retract my
> Acked-by for this patch.
>
>>>> ---
>>>>   drivers/mfd/qcom-pm8008.c | 2 +-
>>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mfd/qcom-pm8008.c b/drivers/mfd/qcom-pm8008.c
>>>> index c472d7f8103c..dfefa60d693b 100644
>>>> --- a/drivers/mfd/qcom-pm8008.c
>>>> +++ b/drivers/mfd/qcom-pm8008.c
>>>> @@ -223,7 +223,7 @@ static int pm8008_probe(struct i2c_client *client)
>>>>        struct pm8008_data *chip;
>>>>
>>>>        chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
>>>> -     if (!chip)
>>>> +     if (IS_ERR(chip))
>>>>                return -ENOMEM;
>>>>
>>>>        chip->dev = &client->dev;
>>>> --
>>>> 2.25.1
>>>>
>>
>>
>> -- 
>> With best wishes
>> Dmitry
> .

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

end of thread, other threads:[~2021-06-04  1:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 14:13 [PATCH -next] mfd: pm8008: Fix return value check in pm8008_probe() Yang Yingliang
2021-06-03 17:12 ` Guru Das Srinagesh
2021-06-03 17:31   ` Dmitry Baryshkov
2021-06-03 19:05     ` Guru Das Srinagesh
2021-06-04  1:26       ` Yang Yingliang

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).