Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <ebiggers@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>

authored by

Eric Biggers and committed by
Mikulas Patocka
71dab3b9 b39b3c81

+4 -7
+4 -7
drivers/md/dm-verity-fec.c
··· 52 52 struct dm_verity_fec_io *fio, u64 index_in_region, 53 53 int target_region, unsigned int out_pos, int neras) 54 54 { 55 - int r, corrected = 0, res; 55 + int r = 0, corrected = 0, res; 56 56 struct dm_buffer *buf; 57 57 unsigned int n, i, j, parity_pos, to_copy; 58 58 uint16_t par_buf[DM_VERITY_FEC_MAX_ROOTS]; ··· 118 118 NULL, neras, fio->erasures, 0, NULL); 119 119 if (res < 0) { 120 120 r = res; 121 - goto error; 121 + goto done; 122 122 } 123 - 124 123 corrected += res; 125 124 fio->output[out_pos++] = msg_buf[target_region]; 126 125 ··· 127 128 goto done; 128 129 } 129 130 done: 130 - r = corrected; 131 - error: 132 131 dm_bufio_release(buf); 133 132 134 133 if (r < 0 && neras) 135 134 DMERR_LIMIT("%s: FEC %llu: failed to correct: %d", 136 135 v->data_dev->name, index_in_region, r); 137 - else if (r > 0) 136 + else if (r == 0 && corrected > 0) 138 137 DMWARN_LIMIT("%s: FEC %llu: corrected %d errors", 139 - v->data_dev->name, index_in_region, r); 138 + v->data_dev->name, index_in_region, corrected); 140 139 141 140 return r; 142 141 }