mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
mmc: mmc_spi: correct the while condition
When variable i will become 0, while(i--) loop breaks but variable i will again decrement to -1 because of i-- and that's why below condition "if (!i && (r != resp_match_value)" will never execute, So doing "i--" inside of while() loop solves this problem. Signed-off-by: Pragnesh Patel <pragnesh.patel@sifive.com> Reviewed-by: Bin Meng <bin.meng@windriver.com> Tested-by: Bin Meng <bin.meng@windriver.com>
This commit is contained in:
parent
497c7598c4
commit
3ba1d53c42
1 changed files with 3 additions and 1 deletions
|
@ -105,12 +105,14 @@ static int mmc_spi_sendcmd(struct udevice *dev,
|
|||
if (resp_match) {
|
||||
r = ~resp_match_value;
|
||||
i = CMD_TIMEOUT;
|
||||
while (i--) {
|
||||
while (i) {
|
||||
ret = dm_spi_xfer(dev, 1 * 8, NULL, &r, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
debug(" resp%d=0x%x", rpos, r);
|
||||
rpos++;
|
||||
i--;
|
||||
|
||||
if (r == resp_match_value)
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue