spi: cadence_qspi: Off by 1 in test for timeout
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Tue, 12 Aug 2025 11:34:38 +0000 (12:34 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 28 Oct 2025 16:27:40 +0000 (10:27 -0600)
commit0ed45794ae9fa3bd8adb1f2d85875f93d94249f8
tree6d7cae717e0ca32a893770cc679ec21a75b36dc8
parent7807ed921314cd7af83fd88162d0b8c6fb20a9ca
spi: cadence_qspi: Off by 1 in test for timeout

In cadence_qspi_apb_exec_flash_cmd the test for a timeout uses a
post-decrement on the variable retry which will result in a value of -1
after the loop exit, or it would if the variable were signed.
To fix this make retry a signed variable and test its value for being
equal to -1.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
drivers/spi/cadence_qspi_apb.c