linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Fabio Estevam <festevam@gmail.com>, ulf.hansson@linaro.org
Cc: kernel@pengutronix.de, linux-mmc@vger.kernel.org,
	stefan.wahren@i2se.com, Fabio Estevam <fabio.estevam@nxp.com>
Subject: Re: [PATCH 1/2] mmc: mxs: Initialize the spinlock prior to using it
Date: Thu, 27 Oct 2016 21:06:24 +0200	[thread overview]
Message-ID: <15d2f274-f1a2-d657-59d0-863be475eae8@denx.de> (raw)
In-Reply-To: <1477594672-31611-1-git-send-email-festevam@gmail.com>

On 10/27/2016 08:57 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@nxp.com>
> 
> An interrupt may occur right after devm_request_irq() is called and
> prior to the spinlock initialization, leading to a kernel oops,
> as the interrupt handler uses the spinlock.
> 
> In order to prevent this problem, move the spinlock initialization 
> prior to requesting the interrupts.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>

Nice, thanks.

Could you also check whether you can disable and clear interrupts in the
probe routine ? I think that might make sense too.

Reviewed-by: Marek Vasut <marex@denx.de>

> ---
>  drivers/mmc/host/mxs-mmc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/mxs-mmc.c b/drivers/mmc/host/mxs-mmc.c
> index d839147..44ecebd 100644
> --- a/drivers/mmc/host/mxs-mmc.c
> +++ b/drivers/mmc/host/mxs-mmc.c
> @@ -661,13 +661,13 @@ static int mxs_mmc_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, mmc);
>  
> +	spin_lock_init(&host->lock);
> +
>  	ret = devm_request_irq(&pdev->dev, irq_err, mxs_mmc_irq_handler, 0,
>  			       dev_name(&pdev->dev), host);
>  	if (ret)
>  		goto out_free_dma;
>  
> -	spin_lock_init(&host->lock);
> -
>  	ret = mmc_add_host(mmc);
>  	if (ret)
>  		goto out_free_dma;
> 


-- 
Best regards,
Marek Vasut

  parent reply	other threads:[~2016-10-27 19:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-27 18:57 [PATCH 1/2] mmc: mxs: Initialize the spinlock prior to using it Fabio Estevam
2016-10-27 18:57 ` [PATCH 2/2] mmc: mxs: Use the spinlock irq variants Fabio Estevam
2016-10-27 19:09   ` Marek Vasut
2016-10-28  2:23   ` Jisheng Zhang
2016-10-28 11:40     ` Fabio Estevam
2016-10-28 11:49       ` Jisheng Zhang
2016-11-05 18:56         ` Fabio Estevam
2016-11-05 19:19           ` Fabio Estevam
2016-10-27 19:06 ` Marek Vasut [this message]
2016-10-27 19:17   ` [PATCH 1/2] mmc: mxs: Initialize the spinlock prior to using it Fabio Estevam
2016-10-27 19:56     ` Marek Vasut
2016-10-28 13:18 ` Stefan Wahren

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=15d2f274-f1a2-d657-59d0-863be475eae8@denx.de \
    --to=marex@denx.de \
    --cc=fabio.estevam@nxp.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-mmc@vger.kernel.org \
    --cc=stefan.wahren@i2se.com \
    --cc=ulf.hansson@linaro.org \
    /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;
as well as URLs for NNTP newsgroup(s).