public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jaehoon Chung <jh80.chung@samsung.com>
To: u-boot@lists.denx.de
Subject: [PATCH 1/3] mmc: mmc_spi: Move argument check to the beginning of mmc_spi_sendcmd()
Date: Mon, 1 Feb 2021 13:51:53 +0900	[thread overview]
Message-ID: <5fdabdf7-dd30-a0fa-e3fa-3b1381925bdd@samsung.com> (raw)
In-Reply-To: <1612153234-7061-2-git-send-email-bmeng.cn@gmail.com>

On 2/1/21 1:20 PM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
> 
> The argument check should happen before any transfer on the SPI lines.
> 
> Signed-off-by: Bin Meng <bin.meng@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;

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 <jh80.chung@samsung.com>

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) {
> 

  reply	other threads:[~2021-02-01  4:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01  4:20 [PATCH 0/3] mmc: mmc_spi: Fix potential spec violation in receiving card response Bin Meng
2021-02-01  4:20 ` [PATCH 1/3] mmc: mmc_spi: Move argument check to the beginning of mmc_spi_sendcmd() Bin Meng
2021-02-01  4:51   ` Jaehoon Chung [this message]
2021-02-01  4:20 ` [PATCH 2/3] mmc: mmc_spi: Fix potential spec violation in receiving card response Bin Meng
2021-02-01  4:56   ` Jaehoon Chung
2021-02-01 21:58   ` Jaehoon Chung
2021-02-01  4:20 ` [PATCH 3/3] mmc: mmc_spi: Document the 3 local functions Bin Meng
2021-02-01  4:53   ` Jaehoon Chung

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5fdabdf7-dd30-a0fa-e3fa-3b1381925bdd@samsung.com \
    --to=jh80.chung@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox