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

mtd: ubi: remove redundant check on bytes_left at end of function

In function ubi_nvmem_reg_read the while-loop can only be exiting
of bytes_left is zero or an error has occurred. There is an exit
return path if an error occurs, so the bytes_left can only be
zero after that point. Hence the check for a non-zero bytes_left
at the end of the function is redundant and can be removed. Remove
the check and just return 0.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Colin Ian King and committed by
Richard Weinberger
67efb77c 07593293

+1 -1
+1 -1
drivers/mtd/ubi/nvmem.c
··· 55 55 if (err) 56 56 return err; 57 57 58 - return bytes_left == 0 ? 0 : -EIO; 58 + return 0; 59 59 } 60 60 61 61 static int ubi_nvmem_add(struct ubi_volume_info *vi)