summary refs log tree commit diff stats
path: root/system/qdev-monitor.c
diff options
context:
space:
mode:
Diffstat (limited to 'system/qdev-monitor.c')
-rw-r--r--system/qdev-monitor.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 5588ed2047..2ac92d0a07 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -628,7 +628,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts,
     DeviceClass *dc;
     const char *driver, *path;
     char *id;
-    DeviceState *dev = NULL;
+    DeviceState *dev;
     BusState *bus = NULL;
     QDict *properties;
 
@@ -717,10 +717,9 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts,
     return dev;
 
 err_del_dev:
-    if (dev) {
-        object_unparent(OBJECT(dev));
-        object_unref(OBJECT(dev));
-    }
+    object_unparent(OBJECT(dev));
+    object_unref(OBJECT(dev));
+
     return NULL;
 }