qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH V17 9/9] qemu-option: use qemu_opts_del without judg


From: Dong Xu Wang
Subject: [Qemu-devel] [PATCH V17 9/9] qemu-option: use qemu_opts_del without judging NULL
Date: Wed, 17 Jul 2013 17:29:48 +0800

Signed-off-by: Dong Xu Wang <address@hidden>
---
 block.c        | 8 ++------
 hw/core/qdev.c | 4 +---
 qemu-char.c    | 4 +---
 qemu-img.c     | 4 +---
 4 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/block.c b/block.c
index e1d1c3d..e700593 100644
--- a/block.c
+++ b/block.c
@@ -408,9 +408,7 @@ int bdrv_create(BlockDriver *drv, const char* filename, 
QemuOpts *opts)
     ret = cco.ret;
 
 out:
-    if (!opts) {
-        qemu_opts_del(cco.opts);
-    }
+    qemu_opts_del(cco.opts);
     g_free(cco.filename);
     return ret;
 }
@@ -4575,9 +4573,7 @@ void bdrv_img_create(const char *filename, const char 
*fmt,
     }
 
 out:
-    if (opts) {
-        qemu_opts_del(opts);
-    }
+    qemu_opts_del(opts);
     qemu_opts_free(create_opts);
 
     if (bs) {
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 9190a7e..2a33eca 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -768,9 +768,7 @@ static void device_initfn(Object *obj)
 static void device_finalize(Object *obj)
 {
     DeviceState *dev = DEVICE(obj);
-    if (dev->opts) {
-        qemu_opts_del(dev->opts);
-    }
+    qemu_opts_del(dev->opts);
 }
 
 static void device_class_base_init(ObjectClass *class, void *data)
diff --git a/qemu-char.c b/qemu-char.c
index 800d6a6..6cd650d 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3379,9 +3379,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);
 }
 
diff --git a/qemu-img.c b/qemu-img.c
index 3f1b6ee..44dd07d 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -1527,9 +1527,7 @@ static int img_convert(int argc, char **argv)
 out:
     qemu_progress_end();
     qemu_opts_free(create_opts);
-    if (opts) {
-        qemu_opts_del(opts);
-    }
+    qemu_opts_del(opts);
     qemu_vfree(buf);
     if (out_bs) {
         bdrv_delete(out_bs);
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]