Skip to contentSkip to conversation

qemu-option: Drop dead assertion

PATCH Applied Markus Armbruster 3 participants 3 messages Jun 10, 2021 – Jul 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-option: Drop dead assertion

Commit c6ecec43b2 "qemu-option: Check return value instead of @err where convenient" simplified

    opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1,
                            &local_err);
    if (local_err) {
        error_propagate(errp, local_err);
        return NULL;
    }

to

    opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1, errp);
    if (!opts) {
        return NULL;
    }

but neglected to delete

    assert(opts != NULL);

Do that now.

---
 util/qemu-option.c | 2 --
 1 file changed, 2 deletions(-)
util/qemu-option.c +0 -2
index 4944015a25..3fa0b13378 100644
@@ -1028,8 +1028,6 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
         return NULL;
     }
 
-    assert(opts != NULL);
-
     for (entry = qdict_first(qdict);
          entry;
          entry = qdict_next(qdict, entry)) {
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · Markus Armbruster

Commit c6ecec43b2 "qemu-option: Check return value instead of @err where convenient" simplified

     opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1,
                             &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return NULL;
     }

to

     opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1, errp);
     if (!opts) {
         return NULL;
     }

but neglected to delete

     assert(opts != NULL);

Do that now.

---
  util/qemu-option.c | 2 --
  1 file changed, 2 deletions(-)
util/qemu-option.c +0 -0
index 4944015a25..3fa0b13378 100644

util/qemu-option.c QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict, · line 1033

Quoted 8 lines
util/qemu-option.c +0 -2
@@ -1028,8 +1028,6 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
          return NULL;
      }
 
-    assert(opts != NULL);
-
      for (entry = qdict_first(qdict);
           entry;
           entry = qdict_next(qdict, entry)) {
#2 lore raw

Le 10/06/2021 à 11:29, Thomas Huth a écrit :

Quoted 29 lines · Markus Armbruster
Quoted 28 lines

Commit c6ecec43b2 "qemu-option: Check return value instead of @err where convenient" simplified

     opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
         return NULL;
     }

to

     opts = qemu_opts_create(list, qdict_get_try_str(qdict, "id"), 1, errp); if (!opts) {
         return NULL;
     }

but neglected to delete

     assert(opts != NULL);

Do that now.

---
  util/qemu-option.c | 2 --

  1 file changed, 2 deletions(-)
Quoted 17 lines

util/qemu-option.c QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict, · line 1033

Quoted 13 lines
util/qemu-option.c +0 -1
index 4944015a25..3fa0b13378 100644
@@ -1028,8 +1028,6 @@ QemuOpts *qemu_opts_from_qdict(QemuOptsList *list, const QDict *qdict,
           return NULL;
       }
   -    assert(opts != NULL);
-
       for (entry = qdict_first(qdict);
            entry;
            entry = qdict_next(qdict, entry)) {

Applied to my trivial-patches branch.

Thanks,
Laurent