Propagate negative vfile ops errors directly instead of using -errno in
z_erofs_compress_segment().

Assisted-by: Codex:GPT-5.5
Signed-off-by: Yifan Zhao <[email protected]>
---
 lib/compress.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/compress.c b/lib/compress.c
index ea07409..e7c60b2 100644
--- a/lib/compress.c
+++ b/lib/compress.c
@@ -1291,14 +1291,16 @@ int z_erofs_compress_segment(struct 
z_erofs_compress_sctx *ctx,
        while (ctx->remaining) {
                const u64 rx = min_t(u64, ctx->remaining,
                                     Z_EROFS_COMPR_QUEUE_SZ - ctx->tail);
-               int ret;
+               ssize_t ret;
 
                ret = (offset == -1 ?
                        erofs_io_read(vf, ctx->queue + ctx->tail, rx) :
                        erofs_io_pread(vf, ctx->queue + ctx->tail, rx,
                                       ictx->fpos + offset));
+               if (ret < 0)
+                       return ret;
                if (ret != rx)
-                       return -errno;
+                       return -EIO;
 
                ctx->remaining -= rx;
                ctx->tail += rx;
-- 
2.47.3


Reply via email to