From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jaehoon Chung Date: Mon, 1 Feb 2021 13:51:53 +0900 Subject: [PATCH 1/3] mmc: mmc_spi: Move argument check to the beginning of mmc_spi_sendcmd() In-Reply-To: <1612153234-7061-2-git-send-email-bmeng.cn@gmail.com> References: <1612153234-7061-1-git-send-email-bmeng.cn@gmail.com> <1612153234-7061-2-git-send-email-bmeng.cn@gmail.com> Message-ID: <5fdabdf7-dd30-a0fa-e3fa-3b1381925bdd@samsung.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/1/21 1:20 PM, Bin Meng wrote: > From: Bin Meng > > The argument check should happen before any transfer on the SPI lines. > > Signed-off-by: Bin Meng > --- > > 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; I'm not sure..does it needs to locate more above? resp_size is referred in debug message. Other thing looks good to me. Reviewed-by: Jaehoon Chung Best Regards, Jaehoon Chung > + > 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) { >