2013-05-17 06:22:12

by Libo Chen

[permalink] [raw]
Subject: [PATCH] MIPS: drivers: fix clk leak


when gptu_r32 fail, we should put clk before return

Signed-off-by: Libo Chen <[email protected]>
---
arch/mips/lantiq/xway/gptu.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/mips/lantiq/xway/gptu.c b/arch/mips/lantiq/xway/gptu.c
index 9861c86..4fa577c 100644
--- a/arch/mips/lantiq/xway/gptu.c
+++ b/arch/mips/lantiq/xway/gptu.c
@@ -169,6 +169,8 @@ static int gptu_probe(struct platform_device *pdev)
if (((gptu_r32(GPTU_ID) >> 8) & 0xff) != GPTU_MAGIC) {
dev_err(&pdev->dev, "Failed to find magic\n");
gptu_hwexit();
+ clk_disable(clk);
+ clk_put(clk);
return -ENAVAIL;
}

--
1.7.1


2013-05-17 09:28:57

by John Crispin

[permalink] [raw]
Subject: Re: [PATCH] MIPS: drivers: fix clk leak

On 17/05/13 08:21, Libo Chen wrote:
>
> when gptu_r32 fail, we should put clk before return
>
> Signed-off-by: Libo Chen<[email protected]>

Acked-by: John Crispin <[email protected]>



> ---
> arch/mips/lantiq/xway/gptu.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/arch/mips/lantiq/xway/gptu.c b/arch/mips/lantiq/xway/gptu.c
> index 9861c86..4fa577c 100644
> --- a/arch/mips/lantiq/xway/gptu.c
> +++ b/arch/mips/lantiq/xway/gptu.c
> @@ -169,6 +169,8 @@ static int gptu_probe(struct platform_device *pdev)
> if (((gptu_r32(GPTU_ID)>> 8)& 0xff) != GPTU_MAGIC) {
> dev_err(&pdev->dev, "Failed to find magic\n");
> gptu_hwexit();
> + clk_disable(clk);
> + clk_put(clk);
> return -ENAVAIL;
> }
>