linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()
@ 2022-03-06 17:44 Christophe JAILLET
  2022-03-07 12:17 ` Ulf Hansson
  2022-03-08 12:54 ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-03-06 17:44 UTC (permalink / raw)
  To: ulf.hansson, cjb
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, kernel-janitors,
	Christophe JAILLET

A dma_free_coherent() call is missing in the error handling path of the
probe, as already done in the remove function.

Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
I've not been able to find a Fixes tag because of the renaming of
function and files.
However, it looks old (before 2008)
---
 drivers/mmc/host/wmt-sdmmc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 163ac9df8cca..8e18f01c0938 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -863,6 +863,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
 	return 0;
 fail6:
 	clk_put(priv->clk_sdmmc);
+	dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
+			  priv->dma_desc_buffer, priv->dma_desc_device_addr);
 fail5:
 	free_irq(dma_irq, priv);
 fail4:
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()
  2022-03-06 17:44 [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Christophe JAILLET
@ 2022-03-07 12:17 ` Ulf Hansson
  2022-03-08 12:54 ` Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2022-03-07 12:17 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: cjb, linux-mmc, linux-arm-kernel, linux-kernel, kernel-janitors

On Sun, 6 Mar 2022 at 18:44, Christophe JAILLET
<christophe.jaillet@wanadoo.fr> wrote:
>
> A dma_free_coherent() call is missing in the error handling path of the
> probe, as already done in the remove function.
>
> Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> I've not been able to find a Fixes tag because of the renaming of
> function and files.
> However, it looks old (before 2008)

Let's keep the above and monitor what the backport process reports.

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/wmt-sdmmc.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index 163ac9df8cca..8e18f01c0938 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -863,6 +863,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
>         return 0;
>  fail6:
>         clk_put(priv->clk_sdmmc);
> +       dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
> +                         priv->dma_desc_buffer, priv->dma_desc_device_addr);
>  fail5:
>         free_irq(dma_irq, priv);
>  fail4:
> --
> 2.32.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()
  2022-03-06 17:44 [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Christophe JAILLET
  2022-03-07 12:17 ` Ulf Hansson
@ 2022-03-08 12:54 ` Dan Carpenter
  2022-03-08 13:36   ` Ulf Hansson
  2022-03-08 21:25   ` Christophe JAILLET
  1 sibling, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2022-03-08 12:54 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: ulf.hansson, cjb, linux-mmc, linux-arm-kernel, linux-kernel,
	kernel-janitors

On Sun, Mar 06, 2022 at 06:44:56PM +0100, Christophe JAILLET wrote:
> A dma_free_coherent() call is missing in the error handling path of the
> probe, as already done in the remove function.
> 
> Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> I've not been able to find a Fixes tag because of the renaming of
> function and files.
> However, it looks old (before 2008)

You did add a fixes tag and it's from 2012.  :P

> ---
>  drivers/mmc/host/wmt-sdmmc.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index 163ac9df8cca..8e18f01c0938 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -863,6 +863,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
>  	return 0;
>  fail6:
>  	clk_put(priv->clk_sdmmc);
> +	dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
> +			  priv->dma_desc_buffer, priv->dma_desc_device_addr);
>  fail5:
>  	free_irq(dma_irq, priv);

This isn't quite right.  If of_clk_get() fails it should call
dma_free_coherent() but it does not.  You need to add:

 fail6:
 	clk_put(priv->clk_sdmmc);
+fail5_and_a_half:
+	dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
+			  priv->dma_desc_buffer, priv->dma_desc_device_addr);
 fail5:
 	free_irq(dma_irq, priv);

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()
  2022-03-08 12:54 ` Dan Carpenter
@ 2022-03-08 13:36   ` Ulf Hansson
  2022-03-08 21:25   ` Christophe JAILLET
  1 sibling, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2022-03-08 13:36 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Christophe JAILLET, linux-mmc, linux-arm-kernel, linux-kernel,
	kernel-janitors

On Tue, 8 Mar 2022 at 13:55, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Sun, Mar 06, 2022 at 06:44:56PM +0100, Christophe JAILLET wrote:
> > A dma_free_coherent() call is missing in the error handling path of the
> > probe, as already done in the remove function.
> >
> > Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > I've not been able to find a Fixes tag because of the renaming of
> > function and files.
> > However, it looks old (before 2008)
>
> You did add a fixes tag and it's from 2012.  :P
>
> > ---
> >  drivers/mmc/host/wmt-sdmmc.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> > index 163ac9df8cca..8e18f01c0938 100644
> > --- a/drivers/mmc/host/wmt-sdmmc.c
> > +++ b/drivers/mmc/host/wmt-sdmmc.c
> > @@ -863,6 +863,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
> >       return 0;
> >  fail6:
> >       clk_put(priv->clk_sdmmc);
> > +     dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
> > +                       priv->dma_desc_buffer, priv->dma_desc_device_addr);
> >  fail5:
> >       free_irq(dma_irq, priv);
>
> This isn't quite right.  If of_clk_get() fails it should call
> dma_free_coherent() but it does not.  You need to add:
>
>  fail6:
>         clk_put(priv->clk_sdmmc);
> +fail5_and_a_half:
> +       dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
> +                         priv->dma_desc_buffer, priv->dma_desc_device_addr);
>  fail5:
>         free_irq(dma_irq, priv);
>
> regards,
> dan carpenter

Thanks Dan for reviewing, I have dropped the $subject patch from my next branch.

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()
  2022-03-08 12:54 ` Dan Carpenter
  2022-03-08 13:36   ` Ulf Hansson
@ 2022-03-08 21:25   ` Christophe JAILLET
  1 sibling, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-03-08 21:25 UTC (permalink / raw)
  To: Dan Carpenter, ulf.hansson
  Cc: linux-mmc, linux-arm-kernel, linux-kernel, kernel-janitors

Le 08/03/2022 à 13:54, Dan Carpenter a écrit :
> On Sun, Mar 06, 2022 at 06:44:56PM +0100, Christophe JAILLET wrote:
>> A dma_free_coherent() call is missing in the error handling path of the
>> probe, as already done in the remove function.
>>
>> Fixes: 3a96dff0f828 ("mmc: SD/MMC Host Controller for Wondermedia WM8505/WM8650")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> I've not been able to find a Fixes tag because of the renaming of
>> function and files.
>> However, it looks old (before 2008)
> 
> You did add a fixes tag and it's from 2012.  :P

Well, a bit too much of copy&paste from [1] :(

[1]: 
https://lore.kernel.org/all/242ebc5e7dedc6b0d7f47cbf7768326c127f955b.1646584729.git.christophe.jaillet@wanadoo.fr/

> 
>> ---
>>   drivers/mmc/host/wmt-sdmmc.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
>> index 163ac9df8cca..8e18f01c0938 100644
>> --- a/drivers/mmc/host/wmt-sdmmc.c
>> +++ b/drivers/mmc/host/wmt-sdmmc.c
>> @@ -863,6 +863,8 @@ static int wmt_mci_probe(struct platform_device *pdev)
>>   	return 0;
>>   fail6:
>>   	clk_put(priv->clk_sdmmc);
>> +	dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
>> +			  priv->dma_desc_buffer, priv->dma_desc_device_addr);
>>   fail5:
>>   	free_irq(dma_irq, priv);
> 
> This isn't quite right.  If of_clk_get() fails it should call
> dma_free_coherent() but it does not.  You need to add:

Agreed, thx for the review.
If no one fix it in the meanwhile, I'll send a v2 this WE or next week.

CJ


> 
>   fail6:
>   	clk_put(priv->clk_sdmmc);
> +fail5_and_a_half:
> +	dma_free_coherent(&pdev->dev, mmc->max_blk_count * 16,
> +			  priv->dma_desc_buffer, priv->dma_desc_device_addr);
>   fail5:
>   	free_irq(dma_irq, priv);
> 
> regards,
> dan carpenter
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-03-08 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-06 17:44 [PATCH] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe() Christophe JAILLET
2022-03-07 12:17 ` Ulf Hansson
2022-03-08 12:54 ` Dan Carpenter
2022-03-08 13:36   ` Ulf Hansson
2022-03-08 21:25   ` Christophe JAILLET

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