* [PATCH] mtd: rawnand: silence static checker warning in nand_setup_interface()
@ 2021-04-20 8:44 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-04-20 8:44 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Boris Brezillon,
Tudor Ambarus, Manivannan Sadhasivam, linux-mtd, linux-kernel,
kernel-janitors
Smatch complains that the error code is not set on this error path:
drivers/mtd/nand/raw/nand_base.c:842 nand_setup_interface()
warn: missing error code 'ret'
But actually returning success is intentional because the NAND chip will
still work in mode 0. This patch adds a "ret = 0;" assignment to make
the intent more clear and to silence the static checker warning. It
doesn't affect the compiled code because GCC optimises the assignment
away.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/mtd/nand/raw/nand_base.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index fb072c444495..e29e5b3d31bf 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -880,6 +880,7 @@ static int nand_setup_interface(struct nand_chip *chip, int chipnr)
if (tmode_param[0] != chip->best_interface_config->timings.mode) {
pr_warn("timing mode %d not acknowledged by the NAND chip\n",
chip->best_interface_config->timings.mode);
+ ret = 0;
goto err_reset_chip;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mtd: rawnand: silence static checker warning in nand_setup_interface()
@ 2021-04-20 8:44 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2021-04-20 8:44 UTC (permalink / raw)
To: Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Boris Brezillon,
Tudor Ambarus, Manivannan Sadhasivam, linux-mtd, linux-kernel,
kernel-janitors
Smatch complains that the error code is not set on this error path:
drivers/mtd/nand/raw/nand_base.c:842 nand_setup_interface()
warn: missing error code 'ret'
But actually returning success is intentional because the NAND chip will
still work in mode 0. This patch adds a "ret = 0;" assignment to make
the intent more clear and to silence the static checker warning. It
doesn't affect the compiled code because GCC optimises the assignment
away.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/mtd/nand/raw/nand_base.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index fb072c444495..e29e5b3d31bf 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -880,6 +880,7 @@ static int nand_setup_interface(struct nand_chip *chip, int chipnr)
if (tmode_param[0] != chip->best_interface_config->timings.mode) {
pr_warn("timing mode %d not acknowledged by the NAND chip\n",
chip->best_interface_config->timings.mode);
+ ret = 0;
goto err_reset_chip;
}
--
2.30.2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: rawnand: silence static checker warning in nand_setup_interface()
2021-04-20 8:44 ` Dan Carpenter
@ 2021-05-10 10:02 ` Miquel Raynal
-1 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2021-05-10 10:02 UTC (permalink / raw)
To: Dan Carpenter, Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Boris Brezillon,
Tudor Ambarus, Manivannan Sadhasivam, linux-mtd, linux-kernel,
kernel-janitors
On Tue, 2021-04-20 at 08:44:51 UTC, Dan Carpenter wrote:
> Smatch complains that the error code is not set on this error path:
>
> drivers/mtd/nand/raw/nand_base.c:842 nand_setup_interface()
> warn: missing error code 'ret'
>
> But actually returning success is intentional because the NAND chip will
> still work in mode 0. This patch adds a "ret = 0;" assignment to make
> the intent more clear and to silence the static checker warning. It
> doesn't affect the compiled code because GCC optimises the assignment
> away.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mtd: rawnand: silence static checker warning in nand_setup_interface()
@ 2021-05-10 10:02 ` Miquel Raynal
0 siblings, 0 replies; 4+ messages in thread
From: Miquel Raynal @ 2021-05-10 10:02 UTC (permalink / raw)
To: Dan Carpenter, Miquel Raynal
Cc: Richard Weinberger, Vignesh Raghavendra, Boris Brezillon,
Tudor Ambarus, Manivannan Sadhasivam, linux-mtd, linux-kernel,
kernel-janitors
On Tue, 2021-04-20 at 08:44:51 UTC, Dan Carpenter wrote:
> Smatch complains that the error code is not set on this error path:
>
> drivers/mtd/nand/raw/nand_base.c:842 nand_setup_interface()
> warn: missing error code 'ret'
>
> But actually returning success is intentional because the NAND chip will
> still work in mode 0. This patch adds a "ret = 0;" assignment to make
> the intent more clear and to silence the static checker warning. It
> doesn't affect the compiled code because GCC optimises the assignment
> away.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-10 10:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 8:44 [PATCH] mtd: rawnand: silence static checker warning in nand_setup_interface() Dan Carpenter
2021-04-20 8:44 ` Dan Carpenter
2021-05-10 10:02 ` Miquel Raynal
2021-05-10 10:02 ` Miquel Raynal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.