OSDN Git Service

vhost: vdpa: remove unnecessary null check
authorGustavo A. R. Silva <gustavo@embeddedor.com>
Mon, 30 Mar 2020 23:50:40 +0000 (18:50 -0500)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 16 Apr 2020 22:31:02 +0000 (18:31 -0400)
container_of is never null, so this null check is
unnecessary.

Addresses-Coverity-ID: 1492006 ("Logically dead code")
Fixes: 20453a45fb06 ("vhost: introduce vDPA-based backend")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Link: https://lore.kernel.org/r/20200330235040.GA9997@embeddedor
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
drivers/vhost/vdpa.c

index 421f02a..3d2cb81 100644 (file)
@@ -678,8 +678,6 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
        int nvqs, i, r, opened;
 
        v = container_of(inode->i_cdev, struct vhost_vdpa, cdev);
-       if (!v)
-               return -ENODEV;
 
        opened = atomic_cmpxchg(&v->opened, 0, 1);
        if (opened)