2014-11-06 13:04:40

by Sudip Mukherjee

[permalink] [raw]
Subject: [PATCH] media: davinci: vpbe: missing clk_put

we are getting struct clk using clk_get before calling
clk_prepare_enable. but if clk_prepare_enable fails, then we are
jumping to fail_mutex_unlock where we are just unlocking the mutex,
but we are not freeing the clock source.
this patch just adds a call to clk_put before jumping to
fail_mutex_unlock.

Signed-off-by: Sudip Mukherjee <[email protected]>
---
drivers/media/platform/davinci/vpbe.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
index 49d2de0..e5df991 100644
--- a/drivers/media/platform/davinci/vpbe.c
+++ b/drivers/media/platform/davinci/vpbe.c
@@ -625,6 +625,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
}
if (clk_prepare_enable(vpbe_dev->dac_clk)) {
ret = -ENODEV;
+ clk_put(vpbe_dev->dac_clk);
goto fail_mutex_unlock;
}
}
--
1.8.1.2


2014-11-07 12:16:01

by Lad, Prabhakar

[permalink] [raw]
Subject: Re: [PATCH] media: davinci: vpbe: missing clk_put

Hi,

Thanks for the patch!

On Thu, Nov 6, 2014 at 1:04 PM, Sudip Mukherjee
<[email protected]> wrote:
> we are getting struct clk using clk_get before calling
> clk_prepare_enable. but if clk_prepare_enable fails, then we are
> jumping to fail_mutex_unlock where we are just unlocking the mutex,
> but we are not freeing the clock source.
> this patch just adds a call to clk_put before jumping to
> fail_mutex_unlock.
>
> Signed-off-by: Sudip Mukherjee <[email protected]>

Acked-by: Lad, Prabhakar <[email protected]>

Thanks,
--Prabhakar

> ---
> drivers/media/platform/davinci/vpbe.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/media/platform/davinci/vpbe.c b/drivers/media/platform/davinci/vpbe.c
> index 49d2de0..e5df991 100644
> --- a/drivers/media/platform/davinci/vpbe.c
> +++ b/drivers/media/platform/davinci/vpbe.c
> @@ -625,6 +625,7 @@ static int vpbe_initialize(struct device *dev, struct vpbe_device *vpbe_dev)
> }
> if (clk_prepare_enable(vpbe_dev->dac_clk)) {
> ret = -ENODEV;
> + clk_put(vpbe_dev->dac_clk);
> goto fail_mutex_unlock;
> }
> }
> --
> 1.8.1.2
>