Skip to contentSkip to conversation

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

PATCH Applied Alexander Sverdlin 2 participants 2 messages May 23, 2022 – May 26, 2022

Subsystems (3)
lore
Share & tools
lore

Alexander Sverdlin

author maintainer
#0 lore raw

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

From: Genjian Zhang <[email protected]>

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")
[AS: Added "ARM:" prefix, punctuation]
---
 arch/arm/mach-ep93xx/clock.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm/mach-ep93xx/clock.c +6 -4
index 4fa6ea5461b7..85a496ddc619 100644
@@ -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;
 }
 
Signature · 1 line
2.36.0
#1 lore raw
This patch was applied to soc/soc.git (for-next) by Arnd Bergmann <[email protected]>:

Hello:

This patch was applied to soc/soc.git (for-next)
by Arnd Bergmann <[email protected]>:

Quoted 11 lines · On Mon, 23 May 2022 07:04:21 +0200 you wrote:

From: Genjian Zhang <[email protected]>

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")
[AS: Added "ARM:" prefix, punctuation]

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html