Skip to contentSkip to conversation

Drop superfluous conditionals around qemu_opts_del()

PATCH Applied Markus Armbruster 4 participants 4 messages Dec 3, 2014 – Dec 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Drop superfluous conditionals around qemu_opts_del()

---
 hw/core/qdev.c | 4 +---
 qemu-char.c    | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
hw/core/qdev.c +1 -3
index 35fd00d..901f289 100644
@@ -1141,9 +1141,7 @@ static void device_finalize(Object *obj)
     NamedGPIOList *ngl, *next;
 
     DeviceState *dev = DEVICE(obj);
-    if (dev->opts) {
-        qemu_opts_del(dev->opts);
-    }
+    qemu_opts_del(dev->opts);
 
     QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {
         QLIST_REMOVE(ngl, node);
qemu-char.c +1 -3
index a8b01da..ef84b53 100644
@@ -3825,9 +3825,7 @@ void qemu_chr_delete(CharDriverState *chr)
     }
     g_free(chr->filename);
     g_free(chr->label);
-    if (chr->opts) {
-        qemu_opts_del(chr->opts);
-    }
+    qemu_opts_del(chr->opts);
     g_free(chr);
 }
 
Signature · 1 line
1.9.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Markus Armbruster
---
 hw/core/qdev.c | 4 +---
 qemu-char.c    | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
hw/core/qdev.c +1 -3
index 35fd00d..901f289 100644
@@ -1141,9 +1141,7 @@ static void device_finalize(Object *obj)
     NamedGPIOList *ngl, *next;
 
     DeviceState *dev = DEVICE(obj);
-    if (dev->opts) {
-        qemu_opts_del(dev->opts);
-    }
+    qemu_opts_del(dev->opts);
 
     QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {
         QLIST_REMOVE(ngl, node);
qemu-char.c +0 -0
index a8b01da..ef84b53 100644

qemu-char.c void qemu_chr_delete(CharDriverState *chr) · line 3831

Quoted 10 lines
qemu-char.c +1 -3
@@ -3825,9 +3825,7 @@ void qemu_chr_delete(CharDriverState *chr)
     }
     g_free(chr->filename);
     g_free(chr->label);
-    if (chr->opts) {
-        qemu_opts_del(chr->opts);
-    }
+    qemu_opts_del(chr->opts);
     g_free(chr);
 }
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Markus Armbruster
Quoted 6 lines · Markus Armbruster
---
 hw/core/qdev.c | 4 +---
 qemu-char.c    | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
Quoted 30 lines
hw/core/qdev.c +1 -3
index 35fd00d..901f289 100644
@@ -1141,9 +1141,7 @@ static void device_finalize(Object *obj)
     NamedGPIOList *ngl, *next;
 
     DeviceState *dev = DEVICE(obj);
-    if (dev->opts) {
-        qemu_opts_del(dev->opts);
-    }
+    qemu_opts_del(dev->opts);
 
     QLIST_FOREACH_SAFE(ngl, &dev->gpios, node, next) {
         QLIST_REMOVE(ngl, node);
qemu-char.c +1 -3
index a8b01da..ef84b53 100644
@@ -3825,9 +3825,7 @@ void qemu_chr_delete(CharDriverState *chr)
     }
     g_free(chr->filename);
     g_free(chr->label);
-    if (chr->opts) {
-        qemu_opts_del(chr->opts);
-    }
+    qemu_opts_del(chr->opts);
     g_free(chr);
 }