From: Bin Meng Date: Tue, 2 Feb 2021 10:48:46 +0800 Subject: [PATCH v2 1/3] mmc: mmc_spi: Move argument check to the beginning of mmc_spi_sendcmd() In-Reply-To: <1612234128-36506-1-git-send-email-bmeng.cn@gmail.com> References: <1612234128-36506-1-git-send-email-bmeng.cn@gmail.com> Message-ID: <1612234128-36506-2-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de From: Bin Meng The argument check should happen before any transfer on the SPI lines. Signed-off-by: Bin Meng Reviewed-by: Jaehoon Chung --- Changes in v2: - move the check before the debug output 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 23b9073..a06862a 100644 --- a/drivers/mmc/mmc_spi.c +++ b/drivers/mmc/mmc_spi.c @@ -78,6 +78,9 @@ static int mmc_spi_sendcmd(struct udevice *dev, int i, rpos = 0, ret = 0; u8 cmdo[7], r; + if (!resp || !resp_size) + return 0; + debug("%s: cmd%d cmdarg=0x%x resp_type=0x%x " "resp_size=%d resp_match=%d resp_match_value=0x%x\n", __func__, cmdidx, cmdarg, resp_type, @@ -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