Skip to contentSkip to conversation

spi: tegra210-quad: Fix iterator outside loop

PATCH In review Krishna Yarlagadda 2 participants 2 messages Feb 27, 2023 – Feb 28, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 spi: tegra210-quad: Fix iterator outside loop

Fix warn: iterator used outside loop: 'xfer'. 'xfer' variable contain invalid value in few conditions. Complete transfer within DATA phase in successful case and at the end for failed transfer.

Fixes 8777dd9dff40 ("spi: tegra210-quad: Fix combined sequence")

---
V2:
- cs_change check moved to DATA_TRANSFER case
- transfer_end call in error case

 drivers/spi/spi-tegra210-quad.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/spi/spi-tegra210-quad.c +8 -4
index 9aaca2289c59..0b9bc3b7f53a 100644
@@ -1156,6 +1156,10 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
 				ret = -EIO;
 				goto exit;
 			}
+			if (!xfer->cs_change) {
+				tegra_qspi_transfer_end(spi);
+				spi_transfer_delay_exec(xfer);
+			}
 			break;
 		default:
 			ret = -EINVAL;
@@ -1164,14 +1168,14 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
 		msg->actual_length += xfer->len;
 		transfer_phase++;
 	}
-	if (!xfer->cs_change) {
-		tegra_qspi_transfer_end(spi);
-		spi_transfer_delay_exec(xfer);
-	}
 	ret = 0;
 
 exit:
 	msg->status = ret;
+	if (ret < 0) {
+		tegra_qspi_transfer_end(spi);
+		spi_transfer_delay_exec(xfer);
+	}
 
 	return ret;
 }
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 9 lines · Krishna Yarlagadda

Fix warn: iterator used outside loop: 'xfer'. 'xfer' variable contain invalid value in few conditions. Complete transfer within DATA phase in successful case and at the end for failed transfer.

Fixes 8777dd9dff40 ("spi: tegra210-quad: Fix combined sequence")

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: tegra210-quad: Fix iterator outside loop

      commit: 2449d436681d40bc63ec2c766fd51b632270d8a7

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