[PATCH][next] mtd: cfi_cmdset_0002: remove redundant assignment to variable ret

Colin Ian King posted 1 patch 1 month, 3 weeks ago
drivers/mtd/chips/cfi_cmdset_0002.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
[PATCH][next] mtd: cfi_cmdset_0002: remove redundant assignment to variable ret
Posted by Colin Ian King 1 month, 3 weeks ago
Variable ret is being assigned a value that is never read, the following
goto statement jumps to a statement that assigns ret a return from the
call to function do_write_oneword_once. The assignment is redundant
and can be removed.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/mtd/chips/cfi_cmdset_0002.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index 9f2223d3e8e1..7c91429a670b 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -1775,18 +1775,16 @@ static int __xipram do_write_oneword_retry(struct map_info *map,
  retry:
 	ret = do_write_oneword_once(map, chip, adr, datum, mode, cfi);
 	if (ret) {
 		/* reset on all failures. */
 		map_write(map, CMD(0xF0), chip->start);
 		/* FIXME - should have reset delay before continuing */
 
-		if (++retry_cnt <= MAX_RETRIES) {
-			ret = 0;
+		if (++retry_cnt <= MAX_RETRIES)
 			goto retry;
-		}
 	}
 	xip_enable(map, chip, adr);
 
 	return ret;
 }
 
 static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip,
-- 
2.39.5
Re: [PATCH][next] mtd: cfi_cmdset_0002: remove redundant assignment to variable ret
Posted by Miquel Raynal 1 month, 1 week ago
On Wed, 2024-10-02 at 17:22:58 UTC, Colin Ian King wrote:
> Variable ret is being assigned a value that is never read, the following
> goto statement jumps to a statement that assigns ret a return from the
> call to function do_write_oneword_once. The assignment is redundant
> and can be removed.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel