summaryrefslogtreecommitdiff
path: root/fs/erofs/decompressor_zstd.c
diff options
context:
space:
mode:
authorGao Xiang <hsiangkao@linux.alibaba.com>2025-11-27 15:31:22 +0800
committerGao Xiang <hsiangkao@linux.alibaba.com>2025-11-30 23:49:32 +0800
commit30e13e41a0eb6bcc97e7c21eafee832b36851969 (patch)
treed3ec1beed0d00551f7e7a478860f07e8d2d5fefb /fs/erofs/decompressor_zstd.c
parent3a991f784c167de08466efe81768ff64c63a8d09 (diff)
erofs: enable error reporting for z_erofs_fixup_insize()
Enable propagation of detailed errors to callers. Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Diffstat (limited to 'fs/erofs/decompressor_zstd.c')
-rw-r--r--fs/erofs/decompressor_zstd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/erofs/decompressor_zstd.c b/fs/erofs/decompressor_zstd.c
index ae51faeb504d..beae49165c69 100644
--- a/fs/erofs/decompressor_zstd.c
+++ b/fs/erofs/decompressor_zstd.c
@@ -143,17 +143,17 @@ static const char *z_erofs_zstd_decompress(struct z_erofs_decompress_req *rq,
zstd_in_buffer in_buf = { NULL, 0, 0 };
zstd_out_buffer out_buf = { NULL, 0, 0 };
struct z_erofs_zstd *strm;
- const char *reason = NULL;
zstd_dstream *stream;
- int zerr, err;
+ const char *reason;
+ int zerr;
/* 1. get the exact compressed size */
dctx.kin = kmap_local_page(*rq->in);
- err = z_erofs_fixup_insize(rq, dctx.kin + rq->pageofs_in,
+ reason = z_erofs_fixup_insize(rq, dctx.kin + rq->pageofs_in,
min(rq->inputsize, sb->s_blocksize - rq->pageofs_in));
- if (err) {
+ if (reason) {
kunmap_local(dctx.kin);
- return ERR_PTR(err);
+ return reason;
}
/* 2. get an available ZSTD context */
@@ -162,7 +162,7 @@ static const char *z_erofs_zstd_decompress(struct z_erofs_decompress_req *rq,
/* 3. multi-call decompress */
stream = zstd_init_dstream(z_erofs_zstd_max_dictsize, strm->wksp, strm->wkspsz);
if (!stream) {
- err = -ENOMEM;
+ reason = ERR_PTR(-ENOMEM);
goto failed_zinit;
}
@@ -208,7 +208,7 @@ failed_zinit:
z_erofs_zstd_head = strm;
spin_unlock(&z_erofs_zstd_lock);
wake_up(&z_erofs_zstd_wq);
- return reason ?: ERR_PTR(err);
+ return reason;
}
const struct z_erofs_decompressor z_erofs_zstd_decomp = {