From: "Zhi, Yong" <yong.zhi@intel.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"Qiu, Tian Shu" <tian.shu.qiu@intel.com>,
"Cao, Bingbu" <bingbu.cao@intel.com>,
"Mani, Rajmohan" <rajmohan.mani@intel.com>,
Sakari Ailus <sakari.ailus@linux.intel.com>
Subject: RE: [bug report] media: staging/intel-ipu3: Add imgu top level pci device driver
Date: Mon, 7 Jan 2019 17:47:38 +0000 [thread overview]
Message-ID: <C193D76D23A22742993887E6D207B54D3DB50587@ORSMSX106.amr.corp.intel.com> (raw)
In-Reply-To: <20190104122856.GA1169@kadam>
Cc Tianshu and others.
Hi, Dan,
Thanks a lot for the code review.
> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@oracle.com]
> Sent: Friday, January 4, 2019 6:29 AM
> To: Zhi, Yong <yong.zhi@intel.com>
> Cc: linux-media@vger.kernel.org
> Subject: [bug report] media: staging/intel-ipu3: Add imgu top level pci device
> driver
>
> Hello Yong Zhi,
>
> The patch 7fc7af649ca7: "media: staging/intel-ipu3: Add imgu top level pci
> device driver" from Dec 6, 2018, leads to the following static checker warning:
>
> drivers/staging/media/ipu3/ipu3.c:493 imgu_isr_threaded()
> warn: 'b' is an error pointer or valid
>
> drivers/staging/media/ipu3/ipu3.c
> 472 static irqreturn_t imgu_isr_threaded(int irq, void *imgu_ptr)
> 473 {
> 474 struct imgu_device *imgu = imgu_ptr;
> 475 struct imgu_media_pipe *imgu_pipe;
> 476 int p;
> 477
> 478 /* Dequeue / queue buffers */
> 479 do {
> 480 u64 ns = ktime_get_ns();
> 481 struct ipu3_css_buffer *b;
> 482 struct imgu_buffer *buf = NULL;
> 483 unsigned int node, pipe;
> 484 bool dummy;
> 485
> 486 do {
> 487 mutex_lock(&imgu->lock);
> 488 b = ipu3_css_buf_dequeue(&imgu->css);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> ipu3_css_buf_dequeue() doesn't return NULL.
>
> 489 mutex_unlock(&imgu->lock);
> 490 } while (PTR_ERR(b) == -EAGAIN);
> 491
> 492 if (IS_ERR_OR_NULL(b)) {
> ^^^^^^^^^^^^^^^^^
> --> 493 if (!b || PTR_ERR(b) == -EBUSY) /* All done */
> ^^
> When a function returns both NULL and error pointers, then NULL is
> considered a special case of success. Like perhaps you request a feature, but
> that feature isn't enabled in the config. It's fine, because the user *chose* to
> turn off the feature, so it's not an error but we also don't have a valid pointer
> we can use.
>
> It looks like you were probably trying to do something like that but you
> missed part of the commit? Otherwise we should delete the dead code.
>
Ack, with recent code changes the NULL check becomes useless, thanks for catching this.
> 494 break;
> 495 dev_err(&imgu->pci_dev->dev,
> 496 "failed to dequeue buffers (%ld)\n",
> 497 PTR_ERR(b));
> 498 break;
> 499 }
> 500
>
> regards,
> dan carpenter
prev parent reply other threads:[~2019-01-07 17:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-04 12:28 [bug report] media: staging/intel-ipu3: Add imgu top level pci device driver Dan Carpenter
2019-01-07 17:47 ` Zhi, Yong [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=C193D76D23A22742993887E6D207B54D3DB50587@ORSMSX106.amr.corp.intel.com \
--to=yong.zhi@intel.com \
--cc=bingbu.cao@intel.com \
--cc=dan.carpenter@oracle.com \
--cc=linux-media@vger.kernel.org \
--cc=rajmohan.mani@intel.com \
--cc=sakari.ailus@linux.intel.com \
--cc=tian.shu.qiu@intel.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).