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 <[email protected]>
---
 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


Reply via email to