spi:pic32: Fix missing error code 'ret' in the failure path
PATCH 1/1 spi:pic32: Fix missing error code 'ret' in the failure path
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.
--- drivers/spi/spi-pic32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-pic32.c +2 -1
@@ -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 */
Signature · 1 line
2.34.1
Sat, May 13, 2023 at 05:26:53AM -0700, Sukrut Bellary kirjoitti:
Quoted 5 lines
smatch warning -
drivers/spi/spi-pic32.c:634pic32_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.
Quoted 1 line
This is based on static analysis only. Compilation tested.
That's why I think it's incorrect fix. You need to fix smatch.
Signature · 2 lines
With Best Regards, Andy Shevchenko