Patchwork [01/12] block: avoid a write only variable

login
register
mail settings
Submitter Blue Swirl
Date Oct. 8, 2010, 9:23 p.m.
Message ID <AANLkTinX9W-5YV-7c+mOFme1k_vE1noHE6F-RxyUhBVC@mail.gmail.com>
Download mbox | patch
Permalink /patch/67291/
State New
Headers show

Comments

Blue Swirl - Oct. 8, 2010, 9:23 p.m.
Compiling with GCC 4.6.0 20100925 produced a warning:
/src/qemu/block/qcow2-refcount.c: In function 'update_refcount':
/src/qemu/block/qcow2-refcount.c:552:13: error: variable 'dummy' set
but not used [-Werror=unused-but-set-variable]

Fix by adding a dummy cast so that the result is not unused.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 block/qcow2-refcount.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Kevin Wolf - Oct. 11, 2010, 8:10 a.m.
Am 08.10.2010 23:23, schrieb Blue Swirl:
> Compiling with GCC 4.6.0 20100925 produced a warning:
> /src/qemu/block/qcow2-refcount.c: In function 'update_refcount':
> /src/qemu/block/qcow2-refcount.c:552:13: error: variable 'dummy' set
> but not used [-Werror=unused-but-set-variable]
> 
> Fix by adding a dummy cast so that the result is not unused.
> 
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

Acked-by: Kevin Wolf <kwolf@redhat.com>

Patch

diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 7082601..0efb676 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -551,6 +551,7 @@  fail:
     if (ret < 0) {
         int dummy;
         dummy = update_refcount(bs, offset, cluster_offset - offset, -addend);
+        (void)dummy;
     }

     return ret;