[PATCH 1/3] mmc: mmc_spi: Move argument check to the beginning of mmc_spi_sendcmd()
Bin Meng
bmeng.cn at gmail.com
Mon Feb 1 05:20:32 CET 2021
From: Bin Meng <bin.meng at windriver.com>
The argument check should happen before any transfer on the SPI lines.
Signed-off-by: Bin Meng <bin.meng at windriver.com>
---
drivers/mmc/mmc_spi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index b1edb6a..85a2818 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -83,6 +83,9 @@ static int mmc_spi_sendcmd(struct udevice *dev,
__func__, cmdidx, cmdarg, resp_type,
resp_size, resp_match, resp_match_value);
+ if (!resp || !resp_size)
+ return 0;
+
cmdo[0] = 0xff;
cmdo[1] = MMC_SPI_CMD(cmdidx);
cmdo[2] = cmdarg >> 24;
@@ -98,9 +101,6 @@ static int mmc_spi_sendcmd(struct udevice *dev,
if (ret)
return ret;
- if (!resp || !resp_size)
- return 0;
-
debug("%s: cmd%d", __func__, cmdidx);
if (resp_match) {
--
2.7.4
More information about the U-Boot
mailing list