* [PATCH 2/2] jz4740-adc: fix resource reclaim in jz4740_adc_probe error path
@ 2010-07-29 8:28 Axel Lin
2010-08-01 22:43 ` Samuel Ortiz
0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2010-07-29 8:28 UTC (permalink / raw)
To: linux-kernel; +Cc: Samuel Ortiz, Lars-Peter Clausen
If mfd_add_devices() fail, we need to relese allocated resources.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
This patch is against linux-next.
drivers/mfd/jz4740-adc.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c
index 2846d24..3ad492c 100644
--- a/drivers/mfd/jz4740-adc.c
+++ b/drivers/mfd/jz4740-adc.c
@@ -326,9 +326,15 @@ static int __devinit jz4740_adc_probe(struct platform_device *pdev)
writeb(0x00, adc->base + JZ_REG_ADC_ENABLE);
writeb(0xff, adc->base + JZ_REG_ADC_CTRL);
- return mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells,
+ ret = mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells,
ARRAY_SIZE(jz4740_adc_cells), mem_base, adc->irq_base);
+ if (ret < 0)
+ goto err_clk_put;
+ return 0;
+
+err_clk_put:
+ clk_put(adc->clk);
err_iounmap:
platform_set_drvdata(pdev, NULL);
iounmap(adc->base);
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 2/2] jz4740-adc: fix resource reclaim in jz4740_adc_probe error path
2010-07-29 8:28 [PATCH 2/2] jz4740-adc: fix resource reclaim in jz4740_adc_probe error path Axel Lin
@ 2010-08-01 22:43 ` Samuel Ortiz
0 siblings, 0 replies; 2+ messages in thread
From: Samuel Ortiz @ 2010-08-01 22:43 UTC (permalink / raw)
To: Axel Lin; +Cc: linux-kernel, Lars-Peter Clausen
Hi Axel,
On Thu, Jul 29, 2010 at 04:28:25PM +0800, Axel Lin wrote:
> If mfd_add_devices() fail, we need to relese allocated resources.
Patch applied, thanks a lot.
Cheers,
Samuel.
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> This patch is against linux-next.
> drivers/mfd/jz4740-adc.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mfd/jz4740-adc.c b/drivers/mfd/jz4740-adc.c
> index 2846d24..3ad492c 100644
> --- a/drivers/mfd/jz4740-adc.c
> +++ b/drivers/mfd/jz4740-adc.c
> @@ -326,9 +326,15 @@ static int __devinit jz4740_adc_probe(struct platform_device *pdev)
> writeb(0x00, adc->base + JZ_REG_ADC_ENABLE);
> writeb(0xff, adc->base + JZ_REG_ADC_CTRL);
>
> - return mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells,
> + ret = mfd_add_devices(&pdev->dev, 0, jz4740_adc_cells,
> ARRAY_SIZE(jz4740_adc_cells), mem_base, adc->irq_base);
> + if (ret < 0)
> + goto err_clk_put;
>
> + return 0;
> +
> +err_clk_put:
> + clk_put(adc->clk);
> err_iounmap:
> platform_set_drvdata(pdev, NULL);
> iounmap(adc->base);
> --
> 1.5.4.3
>
>
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-01 22:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-29 8:28 [PATCH 2/2] jz4740-adc: fix resource reclaim in jz4740_adc_probe error path Axel Lin
2010-08-01 22:43 ` Samuel Ortiz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox