linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
	linux-media@vger.kernel.org, mchehab@kernel.org,
	sakari.ailus@linux.intel.com
Subject: Re: [PATCH -next] media: staging: media: atomisp: pci: fix error return code in atomisp_pci_probe()
Date: Thu, 17 Jun 2021 12:32:19 +0300	[thread overview]
Message-ID: <20210617093219.GE1861@kadam> (raw)
In-Reply-To: <20210617072329.1233662-1-yangyingliang@huawei.com>

On Thu, Jun 17, 2021 at 03:23:29PM +0800, Yang Yingliang wrote:
> If init_atomisp_wdts() fails, atomisp_pci_probe() need return
> error code.
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> index 948769ca6539..5de878fe798b 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_v4l2.c
> @@ -1763,7 +1763,8 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
>  	if (err < 0)
>  		goto register_entities_fail;
>  	/* init atomisp wdts */
> -	if (init_atomisp_wdts(isp) != 0)
> +	err = init_atomisp_wdts(isp);
> +	if (err != 0)

Change this to: if (err).

Only use != 0 when you are talking about numbers or for strcmp().

	if (num != 0) // it's fine because we are talking about zero as
		      // number zero.

	if (len == 0) // fine, length is measured in numbers.

	if (err != 0) // In this case, error is not a number but either
		      // an error code or success.  It's not like -3 is
		      // worse than -2 or anything like that.  It's not
		      // a count or a measurement.

For (strcmp(a, b) != 0), the != means "a != b".

regards,
dan carpenter


      reply	other threads:[~2021-06-17  9:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17  7:23 [PATCH -next] media: staging: media: atomisp: pci: fix error return code in atomisp_pci_probe() Yang Yingliang
2021-06-17  9:32 ` Dan Carpenter [this message]

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=20210617093219.GE1861@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=yangyingliang@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).