diff mbox

[1/2] qcow2: Remove dead check on !ret

Message ID 20180627035752.1425-2-famz@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fam Zheng June 27, 2018, 3:57 a.m. UTC
In the beginning of the function, we initialize the local variable to 0,
and in the body of the function, we check the assigned values and exit
the loop immediately. So here it can never be non-zero.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/qcow2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Philippe Mathieu-Daudé June 27, 2018, 1:05 p.m. UTC | #1
On 06/27/2018 12:57 AM, Fam Zheng wrote:
> In the beginning of the function, we initialize the local variable to 0,
> and in the body of the function, we check the assigned values and exit
> the loop immediately. So here it can never be non-zero.
> 
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Signed-off-by: Fam Zheng <famz@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---
>  block/qcow2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/block/qcow2.c b/block/qcow2.c
> index a3a3aa2a97..ff23063616 100644
> --- a/block/qcow2.c
> +++ b/block/qcow2.c
> @@ -1772,7 +1772,7 @@ static coroutine_fn int qcow2_handle_l2meta(BlockDriverState *bs,
>      while (l2meta != NULL) {
>          QCowL2Meta *next;
>  
> -        if (!ret && link_l2) {
> +        if (link_l2) {
>              ret = qcow2_alloc_cluster_link_l2(bs, l2meta);
>              if (ret) {
>                  goto out;
>
diff mbox

Patch

diff --git a/block/qcow2.c b/block/qcow2.c
index a3a3aa2a97..ff23063616 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1772,7 +1772,7 @@  static coroutine_fn int qcow2_handle_l2meta(BlockDriverState *bs,
     while (l2meta != NULL) {
         QCowL2Meta *next;
 
-        if (!ret && link_l2) {
+        if (link_l2) {
             ret = qcow2_alloc_cluster_link_l2(bs, l2meta);
             if (ret) {
                 goto out;