[PATCH] hw/virtio: remove meaningless NULL-check

Dmitry Frolov posted 1 patch 1 year, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231213081544.1064630-1-frolov@swemel.ru
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
hw/virtio/virtio-bus.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
[PATCH] hw/virtio: remove meaningless NULL-check
Posted by Dmitry Frolov 1 year, 11 months ago
vdev is being dereferenced in the first line of the function.
The following NULL-check makes no sense.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
---
 hw/virtio/virtio-bus.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c
index 896feb37a1..0436f545b8 100644
--- a/hw/virtio/virtio-bus.c
+++ b/hw/virtio/virtio-bus.c
@@ -119,10 +119,8 @@ void virtio_bus_device_unplugged(VirtIODevice *vdev)
 
     DPRINTF("%s: remove device.\n", qbus->name);
 
-    if (vdev != NULL) {
-        if (klass->device_unplugged != NULL) {
-            klass->device_unplugged(qbus->parent);
-        }
+    if (klass->device_unplugged != NULL) {
+        klass->device_unplugged(qbus->parent);
     }
 }
 
-- 
2.34.1
Re: [PATCH] hw/virtio: remove meaningless NULL-check
Posted by Дмитрий Фролов 1 year, 10 months ago
ping