Patchwork qcow2: Silence false warning

login
register
mail settings
Submitter Kevin Wolf
Date June 15, 2012, 11:43 a.m.
Message ID <1339760598-6459-1-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/165091/
State New
Headers show

Comments

Kevin Wolf - June 15, 2012, 11:43 a.m.
Some gcc versions seem not to be able to figure out that the switch
statement covers all possible values and that c is therefore always
initialised. Add a default branch for them.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/qcow2-cluster.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
malc - June 15, 2012, 11:54 a.m.
On Fri, 15 Jun 2012, Kevin Wolf wrote:

> Some gcc versions seem not to be able to figure out that the switch
> statement covers all possible values and that c is therefore always
> initialised. Add a default branch for them.
> 

Applied, thanks.

Patch

diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index b663b9f..d7e0e19 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -471,6 +471,8 @@  int qcow2_get_cluster_offset(BlockDriverState *bs, uint64_t offset,
                 QCOW_OFLAG_COMPRESSED | QCOW_OFLAG_ZERO);
         *cluster_offset &= L2E_OFFSET_MASK;
         break;
+    default:
+        abort();
     }
 
     qcow2_cache_put(bs, s->l2_table_cache, (void**) &l2_table);