summaryrefslogtreecommitdiff
path: root/drivers/spi/spi-stm32-qspi.c
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@foss.st.com>2022-08-26 11:20:31 +0200
committerMark Brown <broonie@kernel.org>2022-08-28 20:20:11 +0100
commit56ec456293239b3c5dfb0e4dcf22972b1b8c571d (patch)
tree65c92e524e7206b34d15f83e7ad2053e0d746531 /drivers/spi/spi-stm32-qspi.c
parent3fe26121dc3a9bf64e18fe0075cd9a92c9cd1b1a (diff)
spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path
The patch a557fca630cc: "spi: stm32_qspi: Add transfer_one_message() spi callback" from Aug 23, 2022, leads to the following Smatch static checker warning: drivers/spi/spi-stm32-qspi.c:627 stm32_qspi_transfer_one_message() error: uninitialized symbol 'ret'.Fix the following Smatch static checker warning: Fixes: a557fca630cc ("spi: stm32_qspi: Add transfer_one_message() spi callback") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com> Link: https://lore.kernel.org/r/20220826092031.1393430-1-patrice.chotard@foss.st.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-stm32-qspi.c')
-rw-r--r--drivers/spi/spi-stm32-qspi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/spi/spi-stm32-qspi.c b/drivers/spi/spi-stm32-qspi.c
index 92459daca95f..679fd1c34f7e 100644
--- a/drivers/spi/spi-stm32-qspi.c
+++ b/drivers/spi/spi-stm32-qspi.c
@@ -562,7 +562,7 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl,
struct spi_transfer *transfer;
struct spi_device *spi = msg->spi;
struct spi_mem_op op;
- int ret;
+ int ret = 0;
if (!spi->cs_gpiod)
return -EOPNOTSUPP;
@@ -592,8 +592,10 @@ static int stm32_qspi_transfer_one_message(struct spi_controller *ctrl,
dummy_bytes = transfer->len;
/* if happens, means that message is not correctly built */
- if (list_is_last(&transfer->transfer_list, &msg->transfers))
+ if (list_is_last(&transfer->transfer_list, &msg->transfers)) {
+ ret = -EINVAL;
goto end_of_transfer;
+ }
transfer = list_next_entry(transfer, transfer_list);
}