[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c80f2441c19766ef13a44c5cd62ec5af6a1e4af3.camel@gmail.com>
Date: Tue, 17 May 2022 09:44:26 +0200
From: Alexander Sverdlin <alexander.sverdlin@...il.com>
To: Genjian Zhang <zhanggenjian123@...il.com>,
hsweeten@...ionengravers.com, linux@...linux.org.uk
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Genjian Zhang <zhanggenjian@...inos.cn>
Subject: Re: [PATCH v2] ep93xx: clock: Do not return the address of the
freed memory
Thank you Genjian!
On Tue, 2022-05-17 at 15:39 +0800, Genjian Zhang wrote:
> Avoid return freed memory addresses,Modified to the actual error
> return value of clk_register().
>
> Fixes: 9645ccc7bd7a ("ep93xx: clock: convert in-place to COMMON_CLK")
> Signed-off-by: Genjian Zhang <zhanggenjian@...inos.cn>
Acked-by: Alexander Sverdlin <alexander.sverdlin@...il.com>
> ---
> arch/arm/mach-ep93xx/clock.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
> index 4fa6ea5461b7..85a496ddc619 100644
> --- a/arch/arm/mach-ep93xx/clock.c
> +++ b/arch/arm/mach-ep93xx/clock.c
> @@ -345,9 +345,10 @@ static struct clk_hw *clk_hw_register_ddiv(const char *name,
> psc->hw.init = &init;
>
> clk = clk_register(NULL, &psc->hw);
> - if (IS_ERR(clk))
> + if (IS_ERR(clk)) {
> kfree(psc);
> -
> + return ERR_CAST(clk);
> + }
> return &psc->hw;
> }
>
> @@ -452,9 +453,10 @@ static struct clk_hw *clk_hw_register_div(const char *name,
> psc->hw.init = &init;
>
> clk = clk_register(NULL, &psc->hw);
> - if (IS_ERR(clk))
> + if (IS_ERR(clk)) {
> kfree(psc);
> -
> + return ERR_CAST(clk);
> + }
> return &psc->hw;
> }
>
--
Alexander Sverdlin.
Powered by blists - more mailing lists