* [PATCH] video: mmp: drop needless devm cleanup
[not found] <1379951159-8294-1-git-send-email-u.kleine-koenig@pengutronix.de>
@ 2013-09-23 16:13 ` Uwe Kleine-König
2013-09-23 16:19 ` Russell King - ARM Linux
2013-09-26 8:43 ` Tomi Valkeinen
0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2013-09-23 16:13 UTC (permalink / raw)
To: linux-arm-kernel
The nice thing about devm_* is that the driver doesn't need to free the
resources but the driver core takes care about that. This also
simplifies the error path quite a bit and removes the wrong check for a
clock pointer being NULL.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/video/mmp/hw/mmp_ctrl.c | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c
index 75dca19..6ac7552 100644
--- a/drivers/video/mmp/hw/mmp_ctrl.c
+++ b/drivers/video/mmp/hw/mmp_ctrl.c
@@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev)
if (IS_ERR(ctrl->clk)) {
dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
ret = -ENOENT;
- goto failed_get_clk;
+ goto failed;
}
clk_prepare_enable(ctrl->clk);
@@ -551,21 +551,8 @@ failed_path_init:
path_deinit(path_plat);
}
- if (ctrl->clk) {
- devm_clk_put(ctrl->dev, ctrl->clk);
- clk_disable_unprepare(ctrl->clk);
- }
-failed_get_clk:
- devm_free_irq(ctrl->dev, ctrl->irq, ctrl);
+ clk_disable_unprepare(ctrl->clk);
failed:
- if (ctrl) {
- if (ctrl->reg_base)
- devm_iounmap(ctrl->dev, ctrl->reg_base);
- devm_release_mem_region(ctrl->dev, res->start,
- resource_size(res));
- devm_kfree(ctrl->dev, ctrl);
- }
-
dev_err(&pdev->dev, "device init failed\n");
return ret;
--
1.8.4.rc3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] video: mmp: drop needless devm cleanup
2013-09-23 16:13 ` [PATCH] video: mmp: drop needless devm cleanup Uwe Kleine-König
@ 2013-09-23 16:19 ` Russell King - ARM Linux
2013-09-24 7:34 ` Tomi Valkeinen
2013-09-26 8:43 ` Tomi Valkeinen
1 sibling, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux @ 2013-09-23 16:19 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Sep 23, 2013 at 06:13:10PM +0200, Uwe Kleine-König wrote:
> The nice thing about devm_* is that the driver doesn't need to free the
> resources but the driver core takes care about that. This also
> simplifies the error path quite a bit and removes the wrong check for a
> clock pointer being NULL.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/video/mmp/hw/mmp_ctrl.c | 17 ++---------------
> 1 file changed, 2 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c
> index 75dca19..6ac7552 100644
> --- a/drivers/video/mmp/hw/mmp_ctrl.c
> +++ b/drivers/video/mmp/hw/mmp_ctrl.c
> @@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev)
> if (IS_ERR(ctrl->clk)) {
> dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
> ret = -ENOENT;
> - goto failed_get_clk;
> + goto failed;
> }
> clk_prepare_enable(ctrl->clk);
>
> @@ -551,21 +551,8 @@ failed_path_init:
> path_deinit(path_plat);
> }
>
> - if (ctrl->clk) {
> - devm_clk_put(ctrl->dev, ctrl->clk);
> - clk_disable_unprepare(ctrl->clk);
And this patch also fixes the above: disabling/unpreparing _after_ putting
the thing - which was quite silly... :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] video: mmp: drop needless devm cleanup
2013-09-23 16:19 ` Russell King - ARM Linux
@ 2013-09-24 7:34 ` Tomi Valkeinen
2013-09-24 7:55 ` Zhou Zhu
0 siblings, 1 reply; 5+ messages in thread
From: Tomi Valkeinen @ 2013-09-24 7:34 UTC (permalink / raw)
To: linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 1499 bytes --]
On 23/09/13 19:19, Russell King - ARM Linux wrote:
> On Mon, Sep 23, 2013 at 06:13:10PM +0200, Uwe Kleine-König wrote:
>> The nice thing about devm_* is that the driver doesn't need to free the
>> resources but the driver core takes care about that. This also
>> simplifies the error path quite a bit and removes the wrong check for a
>> clock pointer being NULL.
>>
>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>> ---
>> drivers/video/mmp/hw/mmp_ctrl.c | 17 ++---------------
>> 1 file changed, 2 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c
>> index 75dca19..6ac7552 100644
>> --- a/drivers/video/mmp/hw/mmp_ctrl.c
>> +++ b/drivers/video/mmp/hw/mmp_ctrl.c
>> @@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev)
>> if (IS_ERR(ctrl->clk)) {
>> dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
>> ret = -ENOENT;
>> - goto failed_get_clk;
>> + goto failed;
>> }
>> clk_prepare_enable(ctrl->clk);
>>
>> @@ -551,21 +551,8 @@ failed_path_init:
>> path_deinit(path_plat);
>> }
>>
>> - if (ctrl->clk) {
>> - devm_clk_put(ctrl->dev, ctrl->clk);
>> - clk_disable_unprepare(ctrl->clk);
>
> And this patch also fixes the above: disabling/unpreparing _after_ putting
> the thing - which was quite silly... :)
Hmm, I wonder if that causes any issues... I.e. should this patch go for
3.12, or is 3.13 fine?
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] video: mmp: drop needless devm cleanup
2013-09-24 7:34 ` Tomi Valkeinen
@ 2013-09-24 7:55 ` Zhou Zhu
0 siblings, 0 replies; 5+ messages in thread
From: Zhou Zhu @ 2013-09-24 7:55 UTC (permalink / raw)
To: linux-arm-kernel
On 09/24/2013 03:34 PM, Tomi Valkeinen wrote:
> On 23/09/13 19:19, Russell King - ARM Linux wrote:
>> On Mon, Sep 23, 2013 at 06:13:10PM +0200, Uwe Kleine-König wrote:
>>> The nice thing about devm_* is that the driver doesn't need to free the
>>> resources but the driver core takes care about that. This also
>>> simplifies the error path quite a bit and removes the wrong check for a
>>> clock pointer being NULL.
>>>
>>> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>>> ---
>>> drivers/video/mmp/hw/mmp_ctrl.c | 17 ++---------------
>>> 1 file changed, 2 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c
>>> index 75dca19..6ac7552 100644
>>> --- a/drivers/video/mmp/hw/mmp_ctrl.c
>>> +++ b/drivers/video/mmp/hw/mmp_ctrl.c
>>> @@ -514,7 +514,7 @@ static int mmphw_probe(struct platform_device *pdev)
>>> if (IS_ERR(ctrl->clk)) {
>>> dev_err(ctrl->dev, "unable to get clk %s\n", mi->clk_name);
>>> ret = -ENOENT;
>>> - goto failed_get_clk;
>>> + goto failed;
>>> }
>>> clk_prepare_enable(ctrl->clk);
>>>
>>> @@ -551,21 +551,8 @@ failed_path_init:
>>> path_deinit(path_plat);
>>> }
>>>
>>> - if (ctrl->clk) {
>>> - devm_clk_put(ctrl->dev, ctrl->clk);
>>> - clk_disable_unprepare(ctrl->clk);
>>
>> And this patch also fixes the above: disabling/unpreparing _after_ putting
>> the thing - which was quite silly... :)
>
> Hmm, I wonder if that causes any issues... I.e. should this patch go for
> 3.12, or is 3.13 fine?
>
> Tomi
>
It would cause oops if probe failed due to some reason - although it
would almost never happen so we missed it.
Thank you for finding it out.
--
Thanks, -Zhou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] video: mmp: drop needless devm cleanup
2013-09-23 16:13 ` [PATCH] video: mmp: drop needless devm cleanup Uwe Kleine-König
2013-09-23 16:19 ` Russell King - ARM Linux
@ 2013-09-26 8:43 ` Tomi Valkeinen
1 sibling, 0 replies; 5+ messages in thread
From: Tomi Valkeinen @ 2013-09-26 8:43 UTC (permalink / raw)
To: linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
On 23/09/13 19:13, Uwe Kleine-König wrote:
> The nice thing about devm_* is that the driver doesn't need to free the
> resources but the driver core takes care about that. This also
> simplifies the error path quite a bit and removes the wrong check for a
> clock pointer being NULL.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> drivers/video/mmp/hw/mmp_ctrl.c | 17 ++---------------
> 1 file changed, 2 insertions(+), 15 deletions(-)
>
Thanks, queuing for 3.12 fixes.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-26 8:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1379951159-8294-1-git-send-email-u.kleine-koenig@pengutronix.de>
2013-09-23 16:13 ` [PATCH] video: mmp: drop needless devm cleanup Uwe Kleine-König
2013-09-23 16:19 ` Russell King - ARM Linux
2013-09-24 7:34 ` Tomi Valkeinen
2013-09-24 7:55 ` Zhou Zhu
2013-09-26 8:43 ` Tomi Valkeinen
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).