Re: [PATCH 1/2] mmc: mxs: Initialize the spinlock prior to using it

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/27/2016 08:57 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxx>
> 
> 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@xxxxxxx>

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@xxxxxxx>

> ---
>  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
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux