Skip to content

Commit

Permalink
block/vpc: fix uninitialised variable compiler warning
Browse files Browse the repository at this point in the history
Since commit cfc87e0 "block/vpc.c: Handle write failures in
get_image_offset()" older versions of gcc (in this case 4.7) incorrectly
warn that "ret" can be used uninitialised in vpc_co_pwritev().

Setting ret to 0 at the start of vpc_co_pwritev() prevents the warning
in gcc 4.7 and enables compilation with -Werror to succeed.

Signed-off-by: Mark Cave-Ayland <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
  • Loading branch information
mcayland authored and pm215 committed Jul 21, 2017
1 parent ff9b547 commit c8115f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion block/vpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ vpc_co_pwritev(BlockDriverState *bs, uint64_t offset, uint64_t bytes,
int64_t image_offset;
int64_t n_bytes;
int64_t bytes_done = 0;
int ret;
int ret = 0;
VHDFooter *footer = (VHDFooter *) s->footer_buf;
QEMUIOVector local_qiov;

Expand Down

0 comments on commit c8115f8

Please sign in to comment.