block/mirror: fix -Werror=maybe-uninitialized false-positive

../block/mirror.c:404:5: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]
../block/mirror.c:895:12: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]
../block/mirror.c:578:12: error: ‘ret’ may be used uninitialized [-Werror=maybe-uninitialized]

Change a variable to int, as suggested by Manos: "bdrv_co_preadv()
which is int and is passed as an int argument to mirror_read_complete()"

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
This commit is contained in:
Marc-André Lureau 2024-04-09 17:12:26 +04:00
parent ba11c88d7a
commit 5791ba529b

View File

@ -349,7 +349,7 @@ static void coroutine_fn mirror_co_read(void *opaque)
MirrorOp *op = opaque; MirrorOp *op = opaque;
MirrorBlockJob *s = op->s; MirrorBlockJob *s = op->s;
int nb_chunks; int nb_chunks;
uint64_t ret; int ret = -1;
uint64_t max_bytes; uint64_t max_bytes;
max_bytes = s->granularity * s->max_iov; max_bytes = s->granularity * s->max_iov;
@ -565,7 +565,7 @@ static void coroutine_fn GRAPH_UNLOCKED mirror_iteration(MirrorBlockJob *s)
bitmap_set(s->in_flight_bitmap, offset / s->granularity, nb_chunks); bitmap_set(s->in_flight_bitmap, offset / s->granularity, nb_chunks);
while (nb_chunks > 0 && offset < s->bdev_length) { while (nb_chunks > 0 && offset < s->bdev_length) {
int ret; int ret = -1;
int64_t io_bytes; int64_t io_bytes;
int64_t io_bytes_acct; int64_t io_bytes_acct;
MirrorMethod mirror_method = MIRROR_METHOD_COPY; MirrorMethod mirror_method = MIRROR_METHOD_COPY;
@ -841,7 +841,7 @@ static int coroutine_fn GRAPH_UNLOCKED mirror_dirty_init(MirrorBlockJob *s)
int64_t offset; int64_t offset;
BlockDriverState *bs; BlockDriverState *bs;
BlockDriverState *target_bs = blk_bs(s->target); BlockDriverState *target_bs = blk_bs(s->target);
int ret; int ret = -1;
int64_t count; int64_t count;
bdrv_graph_co_rdlock(); bdrv_graph_co_rdlock();