linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Goswami, Sanket" <Sanket.Goswami@amd.com>
To: Wei Yongjun <weiyongjun1@huawei.com>
Cc: linux-i2c@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Hulk Robot <hulkci@huawei.com>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>
Subject: Re: [PATCH -next v2] i2c: designware: Fix return value check in navi_amd_register_client()
Date: Wed, 7 Apr 2021 17:25:41 +0530	[thread overview]
Message-ID: <53737d54-d2c0-d4e4-43ca-48734b51b65f@amd.com> (raw)
In-Reply-To: <20210407031137.2750993-1-weiyongjun1@huawei.com>

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

  parent reply	other threads:[~2021-04-07 11:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-04-08 20:48 ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53737d54-d2c0-d4e4-43ca-48734b51b65f@amd.com \
    --to=sanket.goswami@amd.com \
    --cc=hulkci@huawei.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=weiyongjun1@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).