* [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap
@ 2012-01-12 9:55 Julia Lawall
2012-01-17 16:51 ` Vinod Koul
2012-01-31 3:26 ` Vinod Koul
0 siblings, 2 replies; 6+ messages in thread
From: Julia Lawall @ 2012-01-12 9:55 UTC (permalink / raw)
To: Dan Williams; +Cc: kernel-janitors, Vinod Koul, linux-kernel
From: Julia Lawall <Julia.Lawall@lip6.fr>
Add missing iounmap in error handling code, in a case where the function
already preforms iounmap on some other execution path.
This patch additionally adds calls to clk_disable and clk_put.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
statement S,S1;
int ret;
@@
e = \(ioremap\|ioremap_nocache\)(...)
... when != iounmap(e)
if (<+...e...+>) S
... when any
when != iounmap(e)
*if (...)
{ ... when != iounmap(e)
return ...; }
... when any
iounmap(e);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
Perhaps clk_put is not needed? It is not present in the remove function.
drivers/dma/pl330.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 2b3aab3..2f83094 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2690,7 +2690,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
if (IS_ERR(pdmac->clk)) {
dev_err(&adev->dev, "Cannot get operation clock.\n");
ret = -EINVAL;
- goto probe_err1;
+ goto probe_err2;
}
amba_set_drvdata(adev, pdmac);
@@ -2704,11 +2704,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
ret = request_irq(irq, pl330_irq_handler, 0,
dev_name(&adev->dev), pi);
if (ret)
- goto probe_err2;
+ goto probe_err3;
ret = pl330_add(pi);
if (ret)
- goto probe_err3;
+ goto probe_err4;
INIT_LIST_HEAD(&pdmac->desc_pool);
spin_lock_init(&pdmac->pool_lock);
@@ -2765,7 +2765,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
ret = dma_async_device_register(pd);
if (ret) {
dev_err(&adev->dev, "unable to register DMAC\n");
- goto probe_err4;
+ goto probe_err5;
}
dev_info(&adev->dev,
@@ -2778,10 +2778,15 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
return 0;
-probe_err4:
+probe_err5:
pl330_del(pi);
-probe_err3:
+probe_err4:
free_irq(irq, pi);
+probe_err3:
+#ifndef CONFIG_PM_RUNTIME
+ clk_disable(pdmac->clk);
+#endif
+ clk_put(pdmac->clk);
probe_err2:
iounmap(pi->base);
probe_err1:
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap
2012-01-12 9:55 [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap Julia Lawall
@ 2012-01-17 16:51 ` Vinod Koul
2012-01-17 16:55 ` Julia Lawall
2012-01-31 3:26 ` Vinod Koul
1 sibling, 1 reply; 6+ messages in thread
From: Vinod Koul @ 2012-01-17 16:51 UTC (permalink / raw)
To: Julia Lawall; +Cc: Dan Williams, kernel-janitors, linux-kernel
On Thu, 2012-01-12 at 10:55 +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Add missing iounmap in error handling code, in a case where the function
> already preforms iounmap on some other execution path.
>
> This patch additionally adds calls to clk_disable and clk_put.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression e;
> statement S,S1;
> int ret;
> @@
> e = \(ioremap\|ioremap_nocache\)(...)
> ... when != iounmap(e)
> if (<+...e...+>) S
> ... when any
> when != iounmap(e)
> *if (...)
> { ... when != iounmap(e)
> return ...; }
> ... when any
> iounmap(e);
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked by Vinod Koul <vinod.koul@linux.intel.com>
Which tree is this intended for?
>
> ---
> Perhaps clk_put is not needed? It is not present in the remove function.
>
> drivers/dma/pl330.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 2b3aab3..2f83094 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2690,7 +2690,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> if (IS_ERR(pdmac->clk)) {
> dev_err(&adev->dev, "Cannot get operation clock.\n");
> ret = -EINVAL;
> - goto probe_err1;
> + goto probe_err2;
> }
>
> amba_set_drvdata(adev, pdmac);
> @@ -2704,11 +2704,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> ret = request_irq(irq, pl330_irq_handler, 0,
> dev_name(&adev->dev), pi);
> if (ret)
> - goto probe_err2;
> + goto probe_err3;
>
> ret = pl330_add(pi);
> if (ret)
> - goto probe_err3;
> + goto probe_err4;
>
> INIT_LIST_HEAD(&pdmac->desc_pool);
> spin_lock_init(&pdmac->pool_lock);
> @@ -2765,7 +2765,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> ret = dma_async_device_register(pd);
> if (ret) {
> dev_err(&adev->dev, "unable to register DMAC\n");
> - goto probe_err4;
> + goto probe_err5;
> }
>
> dev_info(&adev->dev,
> @@ -2778,10 +2778,15 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>
> return 0;
>
> -probe_err4:
> +probe_err5:
> pl330_del(pi);
> -probe_err3:
> +probe_err4:
> free_irq(irq, pi);
> +probe_err3:
> +#ifndef CONFIG_PM_RUNTIME
> + clk_disable(pdmac->clk);
> +#endif
> + clk_put(pdmac->clk);
> probe_err2:
> iounmap(pi->base);
> probe_err1:
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap
2012-01-17 16:51 ` Vinod Koul
@ 2012-01-17 16:55 ` Julia Lawall
2012-01-17 17:14 ` Vinod Koul
0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2012-01-17 16:55 UTC (permalink / raw)
To: Vinod Koul; +Cc: Dan Williams, kernel-janitors, linux-kernel
On Tue, 17 Jan 2012, Vinod Koul wrote:
> On Thu, 2012-01-12 at 10:55 +0100, Julia Lawall wrote:
>> From: Julia Lawall <Julia.Lawall@lip6.fr>
>>
>> Add missing iounmap in error handling code, in a case where the function
>> already preforms iounmap on some other execution path.
>>
>> This patch additionally adds calls to clk_disable and clk_put.
>>
>> A simplified version of the semantic match that finds this problem is as
>> follows: (http://coccinelle.lip6.fr/)
>>
>> // <smpl>
>> @@
>> expression e;
>> statement S,S1;
>> int ret;
>> @@
>> e = \(ioremap\|ioremap_nocache\)(...)
>> ... when != iounmap(e)
>> if (<+...e...+>) S
>> ... when any
>> when != iounmap(e)
>> *if (...)
>> { ... when != iounmap(e)
>> return ...; }
>> ... when any
>> iounmap(e);
>> // </smpl>
>>
>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> Acked by Vinod Koul <vinod.koul@linux.intel.com>
>
> Which tree is this intended for?
It was generated from linux-next, although I'm not sure if that is the
intended sense of the question.
julia
>>
>> ---
>> Perhaps clk_put is not needed? It is not present in the remove function.
>>
>> drivers/dma/pl330.c | 17 +++++++++++------
>> 1 file changed, 11 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
>> index 2b3aab3..2f83094 100644
>> --- a/drivers/dma/pl330.c
>> +++ b/drivers/dma/pl330.c
>> @@ -2690,7 +2690,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>> if (IS_ERR(pdmac->clk)) {
>> dev_err(&adev->dev, "Cannot get operation clock.\n");
>> ret = -EINVAL;
>> - goto probe_err1;
>> + goto probe_err2;
>> }
>>
>> amba_set_drvdata(adev, pdmac);
>> @@ -2704,11 +2704,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>> ret = request_irq(irq, pl330_irq_handler, 0,
>> dev_name(&adev->dev), pi);
>> if (ret)
>> - goto probe_err2;
>> + goto probe_err3;
>>
>> ret = pl330_add(pi);
>> if (ret)
>> - goto probe_err3;
>> + goto probe_err4;
>>
>> INIT_LIST_HEAD(&pdmac->desc_pool);
>> spin_lock_init(&pdmac->pool_lock);
>> @@ -2765,7 +2765,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>> ret = dma_async_device_register(pd);
>> if (ret) {
>> dev_err(&adev->dev, "unable to register DMAC\n");
>> - goto probe_err4;
>> + goto probe_err5;
>> }
>>
>> dev_info(&adev->dev,
>> @@ -2778,10 +2778,15 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>>
>> return 0;
>>
>> -probe_err4:
>> +probe_err5:
>> pl330_del(pi);
>> -probe_err3:
>> +probe_err4:
>> free_irq(irq, pi);
>> +probe_err3:
>> +#ifndef CONFIG_PM_RUNTIME
>> + clk_disable(pdmac->clk);
>> +#endif
>> + clk_put(pdmac->clk);
>> probe_err2:
>> iounmap(pi->base);
>> probe_err1:
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at http://www.tux.org/lkml/
>
>
> --
> ~Vinod
>
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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 4/15] drivers/dma/pl330.c: add missing iounmap
2012-01-17 16:55 ` Julia Lawall
@ 2012-01-17 17:14 ` Vinod Koul
2012-01-17 17:22 ` Julia Lawall
0 siblings, 1 reply; 6+ messages in thread
From: Vinod Koul @ 2012-01-17 17:14 UTC (permalink / raw)
To: Julia Lawall; +Cc: Dan Williams, kernel-janitors, linux-kernel
On Tue, 2012-01-17 at 17:55 +0100, Julia Lawall wrote:
> >> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> > Acked by Vinod Koul <vinod.koul@linux.intel.com>
> >
> > Which tree is this intended for?
>
> It was generated from linux-next, although I'm not sure if that is
> the
> intended sense of the question.
I meant, which tree is this intended to be merged thru?
slave-dma or any other. Since this is patch is series, typically a
series is applied thru a single tree. If that is not the case, then I am
happy to apply thru slave-dma :)
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap
2012-01-17 17:14 ` Vinod Koul
@ 2012-01-17 17:22 ` Julia Lawall
0 siblings, 0 replies; 6+ messages in thread
From: Julia Lawall @ 2012-01-17 17:22 UTC (permalink / raw)
To: Vinod Koul; +Cc: Dan Williams, kernel-janitors, linux-kernel
On Tue, 17 Jan 2012, Vinod Koul wrote:
> On Tue, 2012-01-17 at 17:55 +0100, Julia Lawall wrote:
>>>> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>>> Acked by Vinod Koul <vinod.koul@linux.intel.com>
>>>
>>> Which tree is this intended for?
>>
>> It was generated from linux-next, although I'm not sure if that is
>> the
>> intended sense of the question.
> I meant, which tree is this intended to be merged thru?
> slave-dma or any other. Since this is patch is series, typically a
> series is applied thru a single tree. If that is not the case, then I am
> happy to apply thru slave-dma :)
There is no dependency between these patches, so I think you can do
whatever seems best with respect to this specific change.
julia
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap
2012-01-12 9:55 [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap Julia Lawall
2012-01-17 16:51 ` Vinod Koul
@ 2012-01-31 3:26 ` Vinod Koul
1 sibling, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2012-01-31 3:26 UTC (permalink / raw)
To: Julia Lawall; +Cc: Dan Williams, kernel-janitors, linux-kernel
On Thu, 2012-01-12 at 10:55 +0100, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Add missing iounmap in error handling code, in a case where the function
> already preforms iounmap on some other execution path.
>
> This patch additionally adds calls to clk_disable and clk_put.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression e;
> statement S,S1;
> int ret;
> @@
> e = \(ioremap\|ioremap_nocache\)(...)
> ... when != iounmap(e)
> if (<+...e...+>) S
> ... when any
> when != iounmap(e)
> *if (...)
> { ... when != iounmap(e)
> return ...; }
> ... when any
> iounmap(e);
> // </smpl>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> Perhaps clk_put is not needed? It is not present in the remove function.
>
> drivers/dma/pl330.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 2b3aab3..2f83094 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2690,7 +2690,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> if (IS_ERR(pdmac->clk)) {
> dev_err(&adev->dev, "Cannot get operation clock.\n");
> ret = -EINVAL;
> - goto probe_err1;
> + goto probe_err2;
> }
>
> amba_set_drvdata(adev, pdmac);
> @@ -2704,11 +2704,11 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> ret = request_irq(irq, pl330_irq_handler, 0,
> dev_name(&adev->dev), pi);
> if (ret)
> - goto probe_err2;
> + goto probe_err3;
>
> ret = pl330_add(pi);
> if (ret)
> - goto probe_err3;
> + goto probe_err4;
>
> INIT_LIST_HEAD(&pdmac->desc_pool);
> spin_lock_init(&pdmac->pool_lock);
> @@ -2765,7 +2765,7 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
> ret = dma_async_device_register(pd);
> if (ret) {
> dev_err(&adev->dev, "unable to register DMAC\n");
> - goto probe_err4;
> + goto probe_err5;
> }
>
> dev_info(&adev->dev,
> @@ -2778,10 +2778,15 @@ pl330_probe(struct amba_device *adev, const struct amba_id *id)
>
> return 0;
>
> -probe_err4:
> +probe_err5:
> pl330_del(pi);
> -probe_err3:
> +probe_err4:
> free_irq(irq, pi);
> +probe_err3:
> +#ifndef CONFIG_PM_RUNTIME
> + clk_disable(pdmac->clk);
> +#endif
> + clk_put(pdmac->clk);
> probe_err2:
> iounmap(pi->base);
> probe_err1:
>
Applied thanks
--
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-01-31 3:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 9:55 [PATCH 4/15] drivers/dma/pl330.c: add missing iounmap Julia Lawall
2012-01-17 16:51 ` Vinod Koul
2012-01-17 16:55 ` Julia Lawall
2012-01-17 17:14 ` Vinod Koul
2012-01-17 17:22 ` Julia Lawall
2012-01-31 3:26 ` Vinod Koul
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).