linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host
@ 2014-07-16  7:50 Xiang Wang
  2014-07-16  9:53 ` Laurent Pinchart
  2014-07-16  9:53 ` [PATCH] mmc: sdhci-pxav3: Use devm_* managed helpers Laurent Pinchart
  0 siblings, 2 replies; 6+ messages in thread
From: Xiang Wang @ 2014-07-16  7:50 UTC (permalink / raw)
  To: Chris Ball, Ulf Hansson, Marcin Wojtas, H Hartley Sweeten,
	Laurent Pinchart, Xiang Wang, linux-mmc, linux-kernel, Chao Xie,
	Xiang Wang

From: Xiang Wang <wangx@marvell.com>

Commit 0dcaa2499b7d111bd70da5b0976c34210c850fb3 improved error
handling of sdhci_add_host. However, "err_of_parse" and "err_cd_req"
should be placed after "pm_runtime_disable(&pdev->dev)".

Signed-off-by: Xiang Wang <wangx@marvell.com>
---
 drivers/mmc/host/sdhci-pxav3.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 2fd73b3..0644655 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -380,11 +380,11 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_of_parse:
-err_cd_req:
 err_add_host:
 	pm_runtime_put_sync(&pdev->dev);
 	pm_runtime_disable(&pdev->dev);
+err_of_parse:
+err_cd_req:
 	clk_disable_unprepare(clk);
 	clk_put(clk);
 err_clk_get:
-- 
1.7.5.4

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

* Re: [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host
  2014-07-16  7:50 [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host Xiang Wang
@ 2014-07-16  9:53 ` Laurent Pinchart
  2014-09-10 13:24   ` Laurent Pinchart
  2014-07-16  9:53 ` [PATCH] mmc: sdhci-pxav3: Use devm_* managed helpers Laurent Pinchart
  1 sibling, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2014-07-16  9:53 UTC (permalink / raw)
  To: Xiang Wang, Xiang Wang
  Cc: Chris Ball, Ulf Hansson, Marcin Wojtas, H Hartley Sweeten,
	linux-mmc, linux-kernel, Chao Xie

Hi Xiang,

Thank you for the patch.

On Wednesday 16 July 2014 15:50:09 Xiang Wang wrote:
> From: Xiang Wang <wangx@marvell.com>
> 
> Commit 0dcaa2499b7d111bd70da5b0976c34210c850fb3 improved error
> handling of sdhci_add_host. However, "err_of_parse" and "err_cd_req"
> should be placed after "pm_runtime_disable(&pdev->dev)".
> 
> Signed-off-by: Xiang Wang <wangx@marvell.com>

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

While we're touching the probe error path, how about converting the driver to 
the devm_* helpers ? I'll send a patch shortly.

> ---
>  drivers/mmc/host/sdhci-pxav3.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index 2fd73b3..0644655 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -380,11 +380,11 @@ static int sdhci_pxav3_probe(struct platform_device
> *pdev)
> 
>  	return 0;
> 
> -err_of_parse:
> -err_cd_req:
>  err_add_host:
>  	pm_runtime_put_sync(&pdev->dev);
>  	pm_runtime_disable(&pdev->dev);
> +err_of_parse:
> +err_cd_req:
>  	clk_disable_unprepare(clk);
>  	clk_put(clk);
>  err_clk_get:

-- 
Regards,

Laurent Pinchart

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

* [PATCH] mmc: sdhci-pxav3: Use devm_* managed helpers
  2014-07-16  7:50 [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host Xiang Wang
  2014-07-16  9:53 ` Laurent Pinchart
@ 2014-07-16  9:53 ` Laurent Pinchart
  2014-07-26  9:47   ` Ulf Hansson
  1 sibling, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2014-07-16  9:53 UTC (permalink / raw)
  To: linux-mmc; +Cc: Xiang Wang

This simplifies probe error and remove code paths.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/mmc/host/sdhci-pxav3.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

This patch applies on top of Xiang Wang's " mmc: sdhci-pxav3: fix error
handling of sdhci_add_host" patch.

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 19b7c8a..e90a188 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -288,15 +288,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 	int ret;
 	struct clk *clk;
 
-	pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL);
+	pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
 	if (!pxa)
 		return -ENOMEM;
 
 	host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
-	if (IS_ERR(host)) {
-		kfree(pxa);
+	if (IS_ERR(host))
 		return PTR_ERR(host);
-	}
 
 	if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
 		ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
@@ -308,7 +306,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
 	pltfm_host = sdhci_priv(host);
 	pltfm_host->priv = pxa;
 
-	clk = clk_get(dev, NULL);
+	clk = devm_clk_get(dev, NULL);
 	if (IS_ERR(clk)) {
 		dev_err(dev, "failed to get io clock\n");
 		ret = PTR_ERR(clk);
@@ -389,11 +387,9 @@ err_add_host:
 err_of_parse:
 err_cd_req:
 	clk_disable_unprepare(clk);
-	clk_put(clk);
 err_clk_get:
 err_mbus_win:
 	sdhci_pltfm_free(pdev);
-	kfree(pxa);
 	return ret;
 }
 
@@ -408,10 +404,8 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
 	pm_runtime_disable(&pdev->dev);
 
 	clk_disable_unprepare(pltfm_host->clk);
-	clk_put(pltfm_host->clk);
 
 	sdhci_pltfm_free(pdev);
-	kfree(pxa);
 
 	return 0;
 }
-- 
Regards,

Laurent Pinchart


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

* Re: [PATCH] mmc: sdhci-pxav3: Use devm_* managed helpers
  2014-07-16  9:53 ` [PATCH] mmc: sdhci-pxav3: Use devm_* managed helpers Laurent Pinchart
@ 2014-07-26  9:47   ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2014-07-26  9:47 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-mmc, Xiang Wang

On 16 July 2014 11:53, Laurent Pinchart
<laurent.pinchart+renesas@ideasonboard.com> wrote:
> This simplifies probe error and remove code paths.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

Thanks! Applied for next.

Kind regards
Uffe


> ---
>  drivers/mmc/host/sdhci-pxav3.c | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
>
> This patch applies on top of Xiang Wang's " mmc: sdhci-pxav3: fix error
> handling of sdhci_add_host" patch.
>
> diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
> index 19b7c8a..e90a188 100644
> --- a/drivers/mmc/host/sdhci-pxav3.c
> +++ b/drivers/mmc/host/sdhci-pxav3.c
> @@ -288,15 +288,13 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>         int ret;
>         struct clk *clk;
>
> -       pxa = kzalloc(sizeof(struct sdhci_pxa), GFP_KERNEL);
> +       pxa = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_pxa), GFP_KERNEL);
>         if (!pxa)
>                 return -ENOMEM;
>
>         host = sdhci_pltfm_init(pdev, &sdhci_pxav3_pdata, 0);
> -       if (IS_ERR(host)) {
> -               kfree(pxa);
> +       if (IS_ERR(host))
>                 return PTR_ERR(host);
> -       }
>
>         if (of_device_is_compatible(np, "marvell,armada-380-sdhci")) {
>                 ret = mv_conf_mbus_windows(pdev, mv_mbus_dram_info());
> @@ -308,7 +306,7 @@ static int sdhci_pxav3_probe(struct platform_device *pdev)
>         pltfm_host = sdhci_priv(host);
>         pltfm_host->priv = pxa;
>
> -       clk = clk_get(dev, NULL);
> +       clk = devm_clk_get(dev, NULL);
>         if (IS_ERR(clk)) {
>                 dev_err(dev, "failed to get io clock\n");
>                 ret = PTR_ERR(clk);
> @@ -389,11 +387,9 @@ err_add_host:
>  err_of_parse:
>  err_cd_req:
>         clk_disable_unprepare(clk);
> -       clk_put(clk);
>  err_clk_get:
>  err_mbus_win:
>         sdhci_pltfm_free(pdev);
> -       kfree(pxa);
>         return ret;
>  }
>
> @@ -408,10 +404,8 @@ static int sdhci_pxav3_remove(struct platform_device *pdev)
>         pm_runtime_disable(&pdev->dev);
>
>         clk_disable_unprepare(pltfm_host->clk);
> -       clk_put(pltfm_host->clk);
>
>         sdhci_pltfm_free(pdev);
> -       kfree(pxa);
>
>         return 0;
>  }
> --
> Regards,
>
> Laurent Pinchart
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host
  2014-07-16  9:53 ` Laurent Pinchart
@ 2014-09-10 13:24   ` Laurent Pinchart
  2014-09-10 13:56     ` Ulf Hansson
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Pinchart @ 2014-09-10 13:24 UTC (permalink / raw)
  To: Xiang Wang
  Cc: Xiang Wang, Chris Ball, Ulf Hansson, Marcin Wojtas,
	H Hartley Sweeten, linux-mmc, linux-kernel, Chao Xie

On Wednesday 16 July 2014 11:53:21 Laurent Pinchart wrote:
> On Wednesday 16 July 2014 15:50:09 Xiang Wang wrote:
> > From: Xiang Wang <wangx@marvell.com>
> > 
> > Commit 0dcaa2499b7d111bd70da5b0976c34210c850fb3 improved error
> > handling of sdhci_add_host. However, "err_of_parse" and "err_cd_req"
> > should be placed after "pm_runtime_disable(&pdev->dev)".
> > 
> > Signed-off-by: Xiang Wang <wangx@marvell.com>
> 
> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

I can't find the patch in mainline, has it been lost somewhere ?

> > ---
> > 
> >  drivers/mmc/host/sdhci-pxav3.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mmc/host/sdhci-pxav3.c
> > b/drivers/mmc/host/sdhci-pxav3.c index 2fd73b3..0644655 100644
> > --- a/drivers/mmc/host/sdhci-pxav3.c
> > +++ b/drivers/mmc/host/sdhci-pxav3.c
> > @@ -380,11 +380,11 @@ static int sdhci_pxav3_probe(struct platform_device
> > *pdev)
> > 
> >  	return 0;
> > 
> > -err_of_parse:
> > 
> > -err_cd_req:
> >  err_add_host:
> >  	pm_runtime_put_sync(&pdev->dev);
> >  	pm_runtime_disable(&pdev->dev);
> > 
> > +err_of_parse:
> > 
> > +err_cd_req:
> >  	clk_disable_unprepare(clk);
> >  	clk_put(clk);
> >  
> >  err_clk_get:

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host
  2014-09-10 13:24   ` Laurent Pinchart
@ 2014-09-10 13:56     ` Ulf Hansson
  0 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2014-09-10 13:56 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: Xiang Wang, Xiang Wang, Chris Ball, Marcin Wojtas,
	H Hartley Sweeten, linux-mmc, linux-kernel@vger.kernel.org,
	Chao Xie

On 10 September 2014 15:24, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Wednesday 16 July 2014 11:53:21 Laurent Pinchart wrote:
>> On Wednesday 16 July 2014 15:50:09 Xiang Wang wrote:
>> > From: Xiang Wang <wangx@marvell.com>
>> >
>> > Commit 0dcaa2499b7d111bd70da5b0976c34210c850fb3 improved error
>> > handling of sdhci_add_host. However, "err_of_parse" and "err_cd_req"
>> > should be placed after "pm_runtime_disable(&pdev->dev)".
>> >
>> > Signed-off-by: Xiang Wang <wangx@marvell.com>
>>
>> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> I can't find the patch in mainline, has it been lost somewhere ?

It was lost, but now found, resolved a conflict for it and queued for 3.18.

Thanks for the reminder!

Kind regards
Uffe

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

end of thread, other threads:[~2014-09-10 13:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16  7:50 [PATCH] mmc: sdhci-pxav3: fix error handling of sdhci_add_host Xiang Wang
2014-07-16  9:53 ` Laurent Pinchart
2014-09-10 13:24   ` Laurent Pinchart
2014-09-10 13:56     ` Ulf Hansson
2014-07-16  9:53 ` [PATCH] mmc: sdhci-pxav3: Use devm_* managed helpers Laurent Pinchart
2014-07-26  9:47   ` Ulf Hansson

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