mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Michael Tretter <m.tretter@pengutronix.de>
Cc: Michael Graichen <michael.graichen@hotmail.com>,
	barebox@lists.infradead.org
Subject: Re: [PATCH 2/2] mci: arasan: configure data transfer only if we actually have data
Date: Tue, 25 May 2021 09:17:27 +0200	[thread overview]
Message-ID: <20210525071727.GQ19819@pengutronix.de> (raw)
In-Reply-To: <20210519073855.2748231-2-m.tretter@pengutronix.de>

On Wed, May 19, 2021 at 09:38:55AM +0200, Michael Tretter wrote:
> If we don't have any data to transfer, we must not set the block size
> and block count.
> 
> If data is NULL, accessing data to get the block size and block count is
> a NULL pointer dereference.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  drivers/mci/arasan-sdhci.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mci/arasan-sdhci.c b/drivers/mci/arasan-sdhci.c
> index 399966e8cf10..3d738774e825 100644
> --- a/drivers/mci/arasan-sdhci.c
> +++ b/drivers/mci/arasan-sdhci.c
> @@ -283,10 +283,12 @@ static int arasan_sdhci_send_cmd(struct mci_host *mci, struct mci_cmd *cmd,
>  	sdhci_set_cmd_xfer_mode(&host->sdhci, cmd, data, false, &command, &xfer);
>  
>  	sdhci_write8(&host->sdhci, SDHCI_TIMEOUT_CONTROL, TIMEOUT_VAL);
> -	sdhci_write16(&host->sdhci, SDHCI_TRANSFER_MODE, xfer);
> -	sdhci_write16(&host->sdhci, SDHCI_BLOCK_SIZE, SDHCI_DMA_BOUNDARY_512K |
> -			    SDHCI_TRANSFER_BLOCK_SIZE(data->blocksize));
> -	sdhci_write16(&host->sdhci, SDHCI_BLOCK_COUNT, data->blocks);
> +	if (data) {
> +		sdhci_write16(&host->sdhci, SDHCI_TRANSFER_MODE, xfer);
> +		sdhci_write16(&host->sdhci, SDHCI_BLOCK_SIZE,
> +			      SDHCI_DMA_BOUNDARY_512K | SDHCI_TRANSFER_BLOCK_SIZE(data->blocksize));
> +		sdhci_write16(&host->sdhci, SDHCI_BLOCK_COUNT, data->blocks);
> +	}

I also stumbled upon this already. Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  reply	other threads:[~2021-05-25  7:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-03 10:07 [PATCH 1/1] Zynq: add support to chainload another barebox Michael Graichen
2021-05-05  8:15 ` Lucas Stach
2021-05-05  8:27   ` Ahmad Fatoum
2021-05-05  9:40   ` AW: " Michael Graichen
2021-05-17  8:23     ` Michael Tretter
2021-05-18  8:09       ` AW: " Michael Graichen
2021-05-19  7:38         ` [PATCH 1/2] mci: arasan: wait for data available only on read Michael Tretter
2021-05-19  7:38           ` [PATCH 2/2] mci: arasan: configure data transfer only if we actually have data Michael Tretter
2021-05-25  7:17             ` Sascha Hauer [this message]
2021-05-25  7:16           ` [PATCH 1/2] mci: arasan: wait for data available only on read Sascha Hauer

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=20210525071727.GQ19819@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.tretter@pengutronix.de \
    --cc=michael.graichen@hotmail.com \
    /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