2022-09-22 19:22:08

by Christophe JAILLET

[permalink] [raw]
Subject: [PATCH v2] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()

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 <[email protected]>
---
Changes since v1:
* Add and use the (ugly named) 'fail5_and_a_half' label [Dan Carpenter <[email protected]>]

v1: https://lore.kernel.org/all/bf2e2e69226b20d173cce66287f59488fd47474b.1646588375.git.christophe.jaillet@wanadoo.fr/
---
drivers/mmc/host/wmt-sdmmc.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
index 163ac9df8cca..9b5c503e3a3f 100644
--- a/drivers/mmc/host/wmt-sdmmc.c
+++ b/drivers/mmc/host/wmt-sdmmc.c
@@ -846,7 +846,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
if (IS_ERR(priv->clk_sdmmc)) {
dev_err(&pdev->dev, "Error getting clock\n");
ret = PTR_ERR(priv->clk_sdmmc);
- goto fail5;
+ goto fail5_and_a_half;
}

ret = clk_prepare_enable(priv->clk_sdmmc);
@@ -863,6 +863,9 @@ static int wmt_mci_probe(struct platform_device *pdev)
return 0;
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);
fail4:
--
2.34.1


2022-09-23 09:32:23

by Dan Carpenter

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()

On Thu, Sep 22, 2022 at 09:06:40PM +0200, 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 <[email protected]>
> ---
> Changes since v1:
> * Add and use the (ugly named) 'fail5_and_a_half' label [Dan Carpenter <[email protected]>]
>

LOL. This really made me laugh.

Reviewed-by: Dan Carpenter <[email protected]>

regards,
dan carpenter

2022-09-27 13:41:38

by Ulf Hansson

[permalink] [raw]
Subject: Re: [PATCH v2] mmc: wmt-sdmmc: Fix an error handling path in wmt_mci_probe()

On Thu, 22 Sept 2022 at 21:06, Christophe JAILLET
<[email protected]> 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 <[email protected]>

Applied for next, thanks!

Kind regards
Uffe


> ---
> Changes since v1:
> * Add and use the (ugly named) 'fail5_and_a_half' label [Dan Carpenter <[email protected]>]
>
> v1: https://lore.kernel.org/all/bf2e2e69226b20d173cce66287f59488fd47474b.1646588375.git.christophe.jaillet@wanadoo.fr/
> ---
> drivers/mmc/host/wmt-sdmmc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/wmt-sdmmc.c b/drivers/mmc/host/wmt-sdmmc.c
> index 163ac9df8cca..9b5c503e3a3f 100644
> --- a/drivers/mmc/host/wmt-sdmmc.c
> +++ b/drivers/mmc/host/wmt-sdmmc.c
> @@ -846,7 +846,7 @@ static int wmt_mci_probe(struct platform_device *pdev)
> if (IS_ERR(priv->clk_sdmmc)) {
> dev_err(&pdev->dev, "Error getting clock\n");
> ret = PTR_ERR(priv->clk_sdmmc);
> - goto fail5;
> + goto fail5_and_a_half;
> }
>
> ret = clk_prepare_enable(priv->clk_sdmmc);
> @@ -863,6 +863,9 @@ static int wmt_mci_probe(struct platform_device *pdev)
> return 0;
> 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);
> fail4:
> --
> 2.34.1
>