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/block/m25p80.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw/block/m25p80.c') diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c index 3045dda..7551343 100644 --- a/hw/block/m25p80.c +++ b/hw/block/m25p80.c @@ -1532,7 +1532,7 @@ static void m25p80_realize(SSIPeripheral *ss, Error **errp) trace_m25p80_binding(s); s->storage = blk_blockalign(s->blk, s->size); - if (blk_pread(s->blk, 0, s->storage, s->size) != s->size) { + if (blk_pread(s->blk, 0, s->storage, s->size) < 0) { error_setg(errp, "failed to read the initial flash content"); return; } -- cgit v1.1