Subject: Coverity: vhost_vdpa_open(): Control flow issues

From: coverity-bot <[email-masked]>
Date: Mon, 13 Apr 2020 09:19:28 -0700

Hello!

This is an experimental automated report about issues detected by Coverity
from a scan of next-20200413 as part of the linux-next weekly scan project:
https://scan.coverity.com/projects/linux-next-weekly-scan

You're getting this email because you were associated with the identified
lines of code (noted below) that were touched by commits:

  Thu Mar 26 22:01:23 2020 +0800
    4c8cf31885f6 ("vhost: introduce vDPA-based backend")

Coverity reported the following:

*** CID 1461662:  Control flow issues  (DEADCODE)
/drivers/vhost/vdpa.c: 682 in vhost_vdpa_open()
676     	struct vhost_dev *dev;
677     	struct vhost_virtqueue **vqs;
678     	int nvqs, i, r, opened;
679
680     	v = container_of(inode->i_cdev, struct vhost_vdpa, cdev);
681     	if (!v)
vvv     CID 1461662:  Control flow issues  (DEADCODE)
vvv     Execution cannot reach this statement: "return -19;".
682     		return -ENODEV;
683
684     	opened = atomic_cmpxchg(&v->opened, 0, 1);
685     	if (opened)
686     		return -EBUSY;
687

If this is a false positive, please let us know so we can mark it as
such, or teach the Coverity rules to be smarter. If not, please make
sure fixes get into linux-next. :) For patches fixing this, please
include these lines (but double-check the "Fixes" first):

Reported-by: coverity-bot <[email-masked]>
Addresses-Coverity-ID: 1461662 ("Control flow issues")
Fixes: 4c8cf31885f6 ("vhost: introduce vDPA-based backend")

Thanks for your attention!

-- 
Coverity-bot