linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path
@ 2022-08-26  9:20 patrice.chotard
  2022-08-28 21:04 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: patrice.chotard @ 2022-08-26  9:20 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel,
	christophe.kerello, patrice.chotard, Dan Carpenter

From: Patrice Chotard <patrice.chotard@foss.st.com>

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>
---
 drivers/spi/spi-stm32-qspi.c | 6 ++++--
 1 file 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);
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path
  2022-08-26  9:20 [PATCH] spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path patrice.chotard
@ 2022-08-28 21:04 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2022-08-28 21:04 UTC (permalink / raw)
  To: patrice.chotard
  Cc: dan.carpenter, linux-kernel, christophe.kerello,
	linux-arm-kernel, linux-spi, linux-stm32

On Fri, 26 Aug 2022 11:20:31 +0200, patrice.chotard@foss.st.com wrote:
> From: Patrice Chotard <patrice.chotard@foss.st.com>
> 
> 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:
> 
> [...]

Applied to

   broonie/spi.git for-next

Thanks!

[1/1] spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path
      commit: 56ec456293239b3c5dfb0e4dcf22972b1b8c571d

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-28 21:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-26  9:20 [PATCH] spi: stm32-qspi: Fix stm32_qspi_transfer_one_message() error path patrice.chotard
2022-08-28 21:04 ` Mark Brown

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).