All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hmp: Remove dead code in hmp_qemu_io()
@ 2016-09-15 15:46 Kevin Wolf
  2016-09-16  8:49 ` Marc-André Lureau
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Wolf @ 2016-09-15 15:46 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

blk can never be NULL, drop the check. This fixes a Coverity warning.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 hmp.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/hmp.c b/hmp.c
index ad33b44..0a16aef 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1924,6 +1924,7 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
 {
     BlockBackend *blk;
     BlockBackend *local_blk = NULL;
+    AioContext *aio_context;
     const char* device = qdict_get_str(qdict, "device");
     const char* command = qdict_get_str(qdict, "command");
     Error *err = NULL;
@@ -1939,17 +1940,12 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
         }
     }
 
-    if (blk) {
-        AioContext *aio_context = blk_get_aio_context(blk);
-        aio_context_acquire(aio_context);
+    aio_context = blk_get_aio_context(blk);
+    aio_context_acquire(aio_context);
 
-        qemuio_command(blk, command);
+    qemuio_command(blk, command);
 
-        aio_context_release(aio_context);
-    } else {
-        error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
-                  "Device '%s' not found", device);
-    }
+    aio_context_release(aio_context);
 
 fail:
     blk_unref(local_blk);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] hmp: Remove dead code in hmp_qemu_io()
  2016-09-15 15:46 [Qemu-devel] [PATCH] hmp: Remove dead code in hmp_qemu_io() Kevin Wolf
@ 2016-09-16  8:49 ` Marc-André Lureau
  0 siblings, 0 replies; 2+ messages in thread
From: Marc-André Lureau @ 2016-09-16  8:49 UTC (permalink / raw)
  To: Kevin Wolf, qemu-block; +Cc: qemu-devel

On Thu, Sep 15, 2016 at 7:50 PM Kevin Wolf <kwolf@redhat.com> wrote:

> blk can never be NULL, drop the check. This fixes a Coverity warning.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>



> ---
>  hmp.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/hmp.c b/hmp.c
> index ad33b44..0a16aef 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -1924,6 +1924,7 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
>  {
>      BlockBackend *blk;
>      BlockBackend *local_blk = NULL;
> +    AioContext *aio_context;
>      const char* device = qdict_get_str(qdict, "device");
>      const char* command = qdict_get_str(qdict, "command");
>      Error *err = NULL;
> @@ -1939,17 +1940,12 @@ void hmp_qemu_io(Monitor *mon, const QDict *qdict)
>          }
>      }
>
> -    if (blk) {
> -        AioContext *aio_context = blk_get_aio_context(blk);
> -        aio_context_acquire(aio_context);
> +    aio_context = blk_get_aio_context(blk);
> +    aio_context_acquire(aio_context);
>
> -        qemuio_command(blk, command);
> +    qemuio_command(blk, command);
>
> -        aio_context_release(aio_context);
> -    } else {
> -        error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
> -                  "Device '%s' not found", device);
> -    }
> +    aio_context_release(aio_context);
>
>  fail:
>      blk_unref(local_blk);
> --
> 1.8.3.1
>
>
> --
Marc-André Lureau

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-16  8:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-15 15:46 [Qemu-devel] [PATCH] hmp: Remove dead code in hmp_qemu_io() Kevin Wolf
2016-09-16  8:49 ` Marc-André Lureau

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.