From bf5b16fa401633475d21d69c66532f5b29e8433d Mon Sep 17 00:00:00 2001 From: Alberto Faria Date: Tue, 5 Jul 2022 17:15:09 +0100 Subject: block: Make blk_{pread,pwrite}() return 0 on success They currently return the value of their 'bytes' parameter on success. Make them return 0 instead, for consistency with other I/O functions and in preparation to implement them using generated_co_wrapper. This also makes it clear that short reads/writes are not possible. Signed-off-by: Alberto Faria Message-Id: <20220705161527.1054072-2-afaria@redhat.com> Reviewed-by: Hanna Reitz Signed-off-by: Hanna Reitz --- hw/misc/mac_via.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hw/misc/mac_via.c') diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 525e38c..c32325d 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -1029,8 +1029,8 @@ static void mos6522_q800_via1_realize(DeviceState *dev, Error **errp) return; } - len = blk_pread(v1s->blk, 0, v1s->PRAM, sizeof(v1s->PRAM)); - if (len != sizeof(v1s->PRAM)) { + ret = blk_pread(v1s->blk, 0, v1s->PRAM, sizeof(v1s->PRAM)); + if (ret < 0) { error_setg(errp, "can't read PRAM contents"); return; } -- cgit v1.1