All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client()
@ 2021-04-07  3:11 Wei Yongjun
  2021-04-07 11:11 ` Jarkko Nikula
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wei Yongjun @ 2021-04-07  3:11 UTC (permalink / raw)
  To: weiyongjun1, Sanket Goswami, Jarkko Nikula
  Cc: linux-i2c, kernel-janitors, Hulk Robot

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

Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
v1 -> v2: fix description format.
---
 drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 7ca0017883a6..0f409a4c2da0 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -132,8 +132,8 @@ static int navi_amd_register_client(struct dw_i2c_dev *dev)
 	info.irq = dev->irq;
 
 	dev->slave = i2c_new_client_device(&dev->adapter, &info);
-	if (!dev->slave)
-		return -ENODEV;
+	if (IS_ERR(dev->slave))
+		return PTR_ERR(dev->slave);
 
 	return 0;
 }


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

* Re: [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client()
  2021-04-07  3:11 [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client() Wei Yongjun
@ 2021-04-07 11:11 ` Jarkko Nikula
  2021-04-07 11:55 ` Goswami, Sanket
  2021-04-08 20:48 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Jarkko Nikula @ 2021-04-07 11:11 UTC (permalink / raw)
  To: Wei Yongjun, Sanket Goswami; +Cc: linux-i2c, kernel-janitors, Hulk Robot

On 4/7/21 6:11 AM, Wei Yongjun wrote:
> In case of error, the function i2c_new_client_device() returns
> ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
> 
> Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> v1 -> v2: fix description format.
> ---
>   drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
> index 7ca0017883a6..0f409a4c2da0 100644
> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
> @@ -132,8 +132,8 @@ static int navi_amd_register_client(struct dw_i2c_dev *dev)
>   	info.irq = dev->irq;
>   
>   	dev->slave = i2c_new_client_device(&dev->adapter, &info);
> -	if (!dev->slave)
> -		return -ENODEV;
> +	if (IS_ERR(dev->slave))
> +		return PTR_ERR(dev->slave);
>   
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

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

* Re: [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client()
  2021-04-07  3:11 [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client() Wei Yongjun
  2021-04-07 11:11 ` Jarkko Nikula
@ 2021-04-07 11:55 ` Goswami, Sanket
  2021-04-08 20:48 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Goswami, Sanket @ 2021-04-07 11:55 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: linux-i2c, kernel-janitors, Hulk Robot, Jarkko Nikula

Hi Wei,

On 07-Apr-21 8:41, Wei Yongjun wrote:
> [CAUTION: External Email]
> 
> In case of error, the function i2c_new_client_device() returns
> ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
> 
> Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
> v1 -> v2: fix description format.
> ---
>  drivers/i2c/busses/i2c-designware-pcidrv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
> index 7ca0017883a6..0f409a4c2da0 100644
> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
> @@ -132,8 +132,8 @@ static int navi_amd_register_client(struct dw_i2c_dev *dev)
>         info.irq = dev->irq;
> 
>         dev->slave = i2c_new_client_device(&dev->adapter, &info);
> -       if (!dev->slave)
> -               return -ENODEV;
> +       if (IS_ERR(dev->slave))
> +               return PTR_ERR(dev->slave);

I got your point, applying mentioned change in my patch.

> 
>         return 0;
>  }
> 

Thanks,
Sanket

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

* Re: [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client()
  2021-04-07  3:11 [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client() Wei Yongjun
  2021-04-07 11:11 ` Jarkko Nikula
  2021-04-07 11:55 ` Goswami, Sanket
@ 2021-04-08 20:48 ` Wolfram Sang
  2 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2021-04-08 20:48 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Sanket Goswami, Jarkko Nikula, linux-i2c, kernel-janitors, Hulk Robot

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

On Wed, Apr 07, 2021 at 03:11:37AM +0000, Wei Yongjun wrote:
> In case of error, the function i2c_new_client_device() returns
> ERR_PTR() and never returns NULL. The NULL test in the return
> value check should be replaced with IS_ERR().
> 
> Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied to for-next, thanks!


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

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

end of thread, other threads:[~2021-04-08 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  3:11 [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client() Wei Yongjun
2021-04-07 11:11 ` Jarkko Nikula
2021-04-07 11:55 ` Goswami, Sanket
2021-04-08 20:48 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.