lkml.org 
[lkml]   [2022]   [Feb]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] spi: Fix warning for Clang build
Date
Clang build fails with
spi-sunplus-sp7021.c:405:2: error: variable 'ret' is used
uninitialized whenever switch default is taken
default:

Restore initializing ret. and add return error at default

Fixes: 47e8fe57a66f ("spi: Modify irq request position and modify parameters")
Reported-by: Tom Rix <trix@redhat.com>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Li-hao Kuo <lhjeff911@gmail.com>
---
drivers/spi/spi-sunplus-sp7021.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-sunplus-sp7021.c b/drivers/spi/spi-sunplus-sp7021.c
index ba5ed9f..460993a 100644
--- a/drivers/spi/spi-sunplus-sp7021.c
+++ b/drivers/spi/spi-sunplus-sp7021.c
@@ -375,7 +375,7 @@ static int sp7021_spi_slave_transfer_one(struct spi_controller *ctlr, struct spi
{
struct sp7021_spi_ctlr *pspim = spi_master_get_devdata(ctlr);
struct device *dev = pspim->dev;
- int mode, ret;
+ int mode, ret = 0;

mode = SP7021_SPI_IDLE;
if (xfer->tx_buf && xfer->rx_buf) {
@@ -403,7 +403,7 @@ static int sp7021_spi_slave_transfer_one(struct spi_controller *ctlr, struct spi
ret = sp7021_spi_slave_rx(spi, xfer);
break;
default:
- break;
+ return -EINVAL;
}
if (xfer->tx_buf)
dma_unmap_single(dev, xfer->tx_dma, xfer->len, DMA_TO_DEVICE);
--
2.7.4
\
 
 \ /
  Last update: 2022-02-10 03:39    [W:0.092 / U:1.536 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site