From: Eric Biggers Date: Fri, 6 Feb 2026 04:59:39 +0000 (-0800) Subject: dm-verity-fec: make fec_decode_bufs() just return 0 or error X-Git-Tag: v7.1-rc1~148^2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71dab3b90f177462a23af81658c9cea327016137;p=thirdparty%2Flinux.git dm-verity-fec: make fec_decode_bufs() just return 0 or error fec_decode_bufs() returns the number of errors corrected or a negative errno value. However, the caller just checks for an errno value and doesn't do anything with the number of errors corrected. Simplify the code by just returning 0 instead of the number of errors corrected. Signed-off-by: Eric Biggers Signed-off-by: Mikulas Patocka --- diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c index 956e032109431..96728e35e8dfb 100644 --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c @@ -52,7 +52,7 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, struct dm_verity_fec_io *fio, u64 index_in_region, int target_region, unsigned int out_pos, int neras) { - int r, corrected = 0, res; + int r = 0, corrected = 0, res; struct dm_buffer *buf; unsigned int n, i, j, parity_pos, to_copy; uint16_t par_buf[DM_VERITY_FEC_MAX_ROOTS]; @@ -118,9 +118,8 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, NULL, neras, fio->erasures, 0, NULL); if (res < 0) { r = res; - goto error; + goto done; } - corrected += res; fio->output[out_pos++] = msg_buf[target_region]; @@ -128,16 +127,14 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_io *io, goto done; } done: - r = corrected; -error: dm_bufio_release(buf); if (r < 0 && neras) DMERR_LIMIT("%s: FEC %llu: failed to correct: %d", v->data_dev->name, index_in_region, r); - else if (r > 0) + else if (r == 0 && corrected > 0) DMWARN_LIMIT("%s: FEC %llu: corrected %d errors", - v->data_dev->name, index_in_region, r); + v->data_dev->name, index_in_region, corrected); return r; }