diff mbox series

ARM: ep93xx: clock: Do not return the address of the freed memory

Message ID 20220523050421.322555-1-alexander.sverdlin@gmail.com (mailing list archive)
State Accepted
Commit 201155540334d2579e9bfc310950a636e7f5daec
Headers show
Series ARM: ep93xx: clock: Do not return the address of the freed memory | expand

Commit Message

Alexander Sverdlin May 23, 2022, 5:04 a.m. UTC
From: Genjian Zhang <zhanggenjian123@gmail.com>

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>
[AS: Added "ARM:" prefix, punctuation]
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
---
 arch/arm/mach-ep93xx/clock.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

patchwork-bot+linux-soc@kernel.org May 26, 2022, 2:40 p.m. UTC | #1
Hello:

This patch was applied to soc/soc.git (for-next)
by Arnd Bergmann <arnd@arndb.de>:

On Mon, 23 May 2022 07:04:21 +0200 you wrote:
> From: Genjian Zhang <zhanggenjian123@gmail.com>
> 
> 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>
> [AS: Added "ARM:" prefix, punctuation]
> Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
> 
> [...]

Here is the summary with links:
  - ARM: ep93xx: clock: Do not return the address of the freed memory
    https://git.kernel.org/soc/soc/c/201155540334

You are awesome, thank you!
diff mbox series

Patch

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;
 }