* [PATCH] spi:pic32: Fix missing error code 'ret' in the failure path
@ 2023-05-13 12:26 Sukrut Bellary
2023-05-13 15:14 ` andy.shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Sukrut Bellary @ 2023-05-13 12:26 UTC (permalink / raw)
To: Mark Brown; +Cc: Sukrut Bellary, linux-spi, linux-kernel
smatch warning -
drivers/spi/spi-pic32.c:634 pic32_spi_dma_prep() warn: missing error code 'ret'
Currently in case of pic32_spi_dma_config() failure, SUCCESS is returned.
Capture and return the error code in the failure path.
This is based on static analysis only. Compilation tested.
Signed-off-by: Sukrut Bellary <sukrut.bellary@linux.com>
---
drivers/spi/spi-pic32.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-pic32.c b/drivers/spi/spi-pic32.c
index f2af5e653f3d..2b1b1eea9c64 100644
--- a/drivers/spi/spi-pic32.c
+++ b/drivers/spi/spi-pic32.c
@@ -630,7 +630,8 @@ static int pic32_spi_dma_prep(struct pic32_spi *pic32s, struct device *dev)
goto out_err;
}
- if (pic32_spi_dma_config(pic32s, DMA_SLAVE_BUSWIDTH_1_BYTE))
+ ret = pic32_spi_dma_config(pic32s, DMA_SLAVE_BUSWIDTH_1_BYTE);
+ if (ret)
goto out_err;
/* DMA chnls allocated and prepared */
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] spi:pic32: Fix missing error code 'ret' in the failure path
2023-05-13 12:26 [PATCH] spi:pic32: Fix missing error code 'ret' in the failure path Sukrut Bellary
@ 2023-05-13 15:14 ` andy.shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: andy.shevchenko @ 2023-05-13 15:14 UTC (permalink / raw)
To: Sukrut Bellary; +Cc: Mark Brown, linux-spi, linux-kernel
Sat, May 13, 2023 at 05:26:53AM -0700, Sukrut Bellary kirjoitti:
> smatch warning -
> drivers/spi/spi-pic32.c:634 pic32_spi_dma_prep() warn: missing error code 'ret'
>
> Currently in case of pic32_spi_dma_config() failure, SUCCESS is returned.
> Capture and return the error code in the failure path.
The comment above the pic32_spi_dma_config() call on the caller side suggests
that DMA is optional. With that in mind the current code won't prevent us from
using the driver in PIO mode.
> This is based on static analysis only. Compilation tested.
That's why I think it's incorrect fix. You need to fix smatch.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-05-13 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-13 12:26 [PATCH] spi:pic32: Fix missing error code 'ret' in the failure path Sukrut Bellary
2023-05-13 15:14 ` andy.shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).