qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block/qcow2-cluster: remove dead code
@ 2020-10-15 12:13 Elena Afanasova
  2020-10-15 12:45 ` Kevin Wolf
  0 siblings, 1 reply; 2+ messages in thread
From: Elena Afanasova @ 2020-10-15 12:13 UTC (permalink / raw)
  To: kwolf, mreitz, qemu-block; +Cc: qemu-trivial, qemu-devel

Since handle_dependencies() returns 0 or -EAGAIN the following case can be removed.
Spotted by PVS-Studio.

Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
---
 block/qcow2-cluster.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index aa87d3e99b..e2e0db0cc9 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -1806,8 +1806,6 @@ again:
              * structs before starting over. */
             assert(*m == NULL);
             goto again;
-        } else if (ret < 0) {
-            return ret;
         } else if (cur_bytes == 0) {
             break;
         } else {
-- 
2.25.1




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

* Re: [PATCH] block/qcow2-cluster: remove dead code
  2020-10-15 12:13 [PATCH] block/qcow2-cluster: remove dead code Elena Afanasova
@ 2020-10-15 12:45 ` Kevin Wolf
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin Wolf @ 2020-10-15 12:45 UTC (permalink / raw)
  To: Elena Afanasova; +Cc: qemu-trivial, qemu-devel, qemu-block, mreitz

Am 15.10.2020 um 14:13 hat Elena Afanasova geschrieben:
> Since handle_dependencies() returns 0 or -EAGAIN the following case can be removed.
> Spotted by PVS-Studio.
> 
> Signed-off-by: Elena Afanasova <eafanasova@gmail.com>
> ---
>  block/qcow2-cluster.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
> index aa87d3e99b..e2e0db0cc9 100644
> --- a/block/qcow2-cluster.c
> +++ b/block/qcow2-cluster.c
> @@ -1806,8 +1806,6 @@ again:
>               * structs before starting over. */
>              assert(*m == NULL);
>              goto again;
> -        } else if (ret < 0) {
> -            return ret;
>          } else if (cur_bytes == 0) {
>              break;
>          } else {

Technically correct, but let's keep it for anyone who will return a
different error code in the future. I think we should always check for
any error even if it is currently not produced.

Kevin



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

end of thread, other threads:[~2020-10-15 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-15 12:13 [PATCH] block/qcow2-cluster: remove dead code Elena Afanasova
2020-10-15 12:45 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).