From: Alexander Sverdlin <alexander.sverdlin@gmail.com>
To: Genjian Zhang <zhanggenjian123@gmail.com>,
hsweeten@visionengravers.com, linux@armlinux.org.uk
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Genjian Zhang <zhanggenjian@kylinos.cn>
Subject: Re: [PATCH v2] ep93xx: clock: Do not return the address of the freed memory
Date: Tue, 17 May 2022 09:44:26 +0200 [thread overview]
Message-ID: <c80f2441c19766ef13a44c5cd62ec5af6a1e4af3.camel@gmail.com> (raw)
In-Reply-To: <20220517073946.1339333-1-zhanggenjian@kylinos.cn>
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@kylinos.cn>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.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.
prev parent reply other threads:[~2022-05-17 7:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 7:39 Genjian Zhang
2022-05-17 7:44 ` Alexander Sverdlin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c80f2441c19766ef13a44c5cd62ec5af6a1e4af3.camel@gmail.com \
--to=alexander.sverdlin@gmail.com \
--cc=hsweeten@visionengravers.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=zhanggenjian123@gmail.com \
--cc=zhanggenjian@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®