mirror of https://github.com/xemu-project/xemu.git
block: Fix compiler warning (-Werror=uninitialized)
The patch fixes a warning from gcc (Debian 4.6.3-14+rpi1) 4.6.3: block/stream.c:141:22: error: ‘copy’ may be used uninitialized in this function [-Werror=uninitialized] This is not a real bug - a better compiler would not complain. Now 'copy' has always a defined value, so the check for ret >= 0 can be removed. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
030be32184
commit
c3e4f43a99
|
@ -119,11 +119,12 @@ wait:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy = false;
|
||||||
|
|
||||||
ret = bdrv_is_allocated(bs, sector_num,
|
ret = bdrv_is_allocated(bs, sector_num,
|
||||||
STREAM_BUFFER_SIZE / BDRV_SECTOR_SIZE, &n);
|
STREAM_BUFFER_SIZE / BDRV_SECTOR_SIZE, &n);
|
||||||
if (ret == 1) {
|
if (ret == 1) {
|
||||||
/* Allocated in the top, no need to copy. */
|
/* Allocated in the top, no need to copy. */
|
||||||
copy = false;
|
|
||||||
} else if (ret >= 0) {
|
} else if (ret >= 0) {
|
||||||
/* Copy if allocated in the intermediate images. Limit to the
|
/* Copy if allocated in the intermediate images. Limit to the
|
||||||
* known-unallocated area [sector_num, sector_num+n). */
|
* known-unallocated area [sector_num, sector_num+n). */
|
||||||
|
@ -138,7 +139,7 @@ wait:
|
||||||
copy = (ret == 1);
|
copy = (ret == 1);
|
||||||
}
|
}
|
||||||
trace_stream_one_iteration(s, sector_num, n, ret);
|
trace_stream_one_iteration(s, sector_num, n, ret);
|
||||||
if (ret >= 0 && copy) {
|
if (copy) {
|
||||||
if (s->common.speed) {
|
if (s->common.speed) {
|
||||||
delay_ns = ratelimit_calculate_delay(&s->limit, n);
|
delay_ns = ratelimit_calculate_delay(&s->limit, n);
|
||||||
if (delay_ns > 0) {
|
if (delay_ns > 0) {
|
||||||
|
|
Loading…
Reference in New Issue