diff mbox series

hw/virtio: remove meaningless NULL-check

Message ID 20231213081544.1064630-1-frolov@swemel.ru (mailing list archive)
State New, archived
Headers show
Series hw/virtio: remove meaningless NULL-check | expand

Commit Message

Dmitry Frolov Dec. 13, 2023, 8:15 a.m. UTC
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(-)

Comments

Dmitry Frolov Jan. 11, 2024, 9:33 a.m. UTC | #1
ping
diff mbox series

Patch

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);
     }
 }