[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230224163513.27290-1-kyarlagadda@nvidia.com>
Date: Fri, 24 Feb 2023 22:05:13 +0530
From: Krishna Yarlagadda <kyarlagadda@...dia.com>
To: <broonie@...nel.org>, <linux-spi@...r.kernel.org>,
<linux-tegra@...r.kernel.org>, <linux-kernel@...r.kernel.org>
CC: <thierry.reding@...il.com>, <jonathanh@...dia.com>,
<skomatineni@...dia.com>, <ldewangan@...dia.com>,
Krishna Yarlagadda <kyarlagadda@...dia.com>
Subject: [PATCH] spi: tegra210-quad: Fix iterator outside loop
Fix warn: iterator used outside loop: 'xfer'
xfer variable may contain invalid value in few conditions.
Move transfer complete check within list loop.
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Link:https://lore.kernel.org/all/202210191211.46FkzKmv-lkp@intel.com/
Fixes: 8777dd9dff40 ("spi: tegra210-quad: Fix combined sequence")
Signed-off-by: Krishna Yarlagadda <kyarlagadda@...dia.com>
---
drivers/spi/spi-tegra210-quad.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-tegra210-quad.c b/drivers/spi/spi-tegra210-quad.c
index 95706153f340..2291effc2c44 100644
--- a/drivers/spi/spi-tegra210-quad.c
+++ b/drivers/spi/spi-tegra210-quad.c
@@ -1178,12 +1178,12 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
goto exit;
}
msg->actual_length += xfer->len;
+ if (!xfer->cs_change && transfer_phase == DATA_TRANSFER) {
+ tegra_qspi_transfer_end(spi);
+ spi_transfer_delay_exec(xfer);
+ }
transfer_phase++;
}
- if (!xfer->cs_change) {
- tegra_qspi_transfer_end(spi);
- spi_transfer_delay_exec(xfer);
- }
ret = 0;
exit:
--
2.17.1
Powered by blists - more mailing lists