linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: yong.zhi@intel.com
Cc: linux-media@vger.kernel.org
Subject: [bug report] media: staging/intel-ipu3: Add imgu top level pci device driver
Date: Fri, 4 Jan 2019 15:28:56 +0300	[thread overview]
Message-ID: <20190104122856.GA1169@kadam> (raw)

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.

    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

             reply	other threads:[~2019-01-04 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-04 12:28 Dan Carpenter [this message]
2019-01-07 17:47 ` [bug report] media: staging/intel-ipu3: Add imgu top level pci device driver Zhi, Yong

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=20190104122856.GA1169@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=linux-media@vger.kernel.org \
    --cc=yong.zhi@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).