* [PATCH] vhost: vdpa: remove unnecessary null check
@ 2020-03-30 23:50 Gustavo A. R. Silva
2020-03-31 2:35 ` Jason Wang
2020-03-31 14:03 ` Michael S. Tsirkin
0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2020-03-30 23:50 UTC (permalink / raw)
To: Michael S. Tsirkin, Jason Wang, Tiwei Bie, Eugenio Pérez
Cc: kvm, virtualization, netdev, linux-kernel, Gustavo A. R. Silva
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>
---
drivers/vhost/vdpa.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
index 421f02a8530a..3d2cb811757a 100644
--- a/drivers/vhost/vdpa.c
+++ b/drivers/vhost/vdpa.c
@@ -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)
--
2.26.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost: vdpa: remove unnecessary null check
2020-03-30 23:50 [PATCH] vhost: vdpa: remove unnecessary null check Gustavo A. R. Silva
@ 2020-03-31 2:35 ` Jason Wang
2020-03-31 14:03 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2020-03-31 2:35 UTC (permalink / raw)
To: Gustavo A. R. Silva, Michael S. Tsirkin, Tiwei Bie, Eugenio Pérez
Cc: kvm, virtualization, netdev, linux-kernel
On 2020/3/31 上午7:50, Gustavo A. R. Silva wrote:
> 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>
> ---
> drivers/vhost/vdpa.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 421f02a8530a..3d2cb811757a 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -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)
Acked-by: Jason Wang <jasowang@redhat.com>
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost: vdpa: remove unnecessary null check
2020-03-30 23:50 [PATCH] vhost: vdpa: remove unnecessary null check Gustavo A. R. Silva
2020-03-31 2:35 ` Jason Wang
@ 2020-03-31 14:03 ` Michael S. Tsirkin
1 sibling, 0 replies; 3+ messages in thread
From: Michael S. Tsirkin @ 2020-03-31 14:03 UTC (permalink / raw)
To: Gustavo A. R. Silva
Cc: Jason Wang, Tiwei Bie, Eugenio Pérez, kvm, virtualization,
netdev, linux-kernel
On Mon, Mar 30, 2020 at 06:50:40PM -0500, Gustavo A. R. Silva wrote:
> 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>
Yes weird. Was the point to test i_cdev? Tiwei?
> ---
> drivers/vhost/vdpa.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 421f02a8530a..3d2cb811757a 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -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)
> --
> 2.26.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-31 14:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-30 23:50 [PATCH] vhost: vdpa: remove unnecessary null check Gustavo A. R. Silva
2020-03-31 2:35 ` Jason Wang
2020-03-31 14:03 ` Michael S. Tsirkin
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).