Skip to content

Commit 2449d43

Browse files
kkyarlagaddabroonie
authored andcommitted
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. Reported-by: Dan Carpenter <[email protected]> Link:https://lore.kernel.org/all/[email protected]/ Fixes: 8777dd9 ("spi: tegra210-quad: Fix combined sequence") Signed-off-by: Krishna Yarlagadda <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 047ee71 commit 2449d43

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/spi/spi-tegra210-quad.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,6 +1156,10 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
11561156
ret = -EIO;
11571157
goto exit;
11581158
}
1159+
if (!xfer->cs_change) {
1160+
tegra_qspi_transfer_end(spi);
1161+
spi_transfer_delay_exec(xfer);
1162+
}
11591163
break;
11601164
default:
11611165
ret = -EINVAL;
@@ -1164,14 +1168,14 @@ static int tegra_qspi_combined_seq_xfer(struct tegra_qspi *tqspi,
11641168
msg->actual_length += xfer->len;
11651169
transfer_phase++;
11661170
}
1167-
if (!xfer->cs_change) {
1168-
tegra_qspi_transfer_end(spi);
1169-
spi_transfer_delay_exec(xfer);
1170-
}
11711171
ret = 0;
11721172

11731173
exit:
11741174
msg->status = ret;
1175+
if (ret < 0) {
1176+
tegra_qspi_transfer_end(spi);
1177+
spi_transfer_delay_exec(xfer);
1178+
}
11751179

11761180
return ret;
11771181
}

0 commit comments

Comments
 (0)