lkml.org 
[lkml]   [2022]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] ep93xx: clock: Do not return the address of the freed memory
Date
Although there will be basic judgments of IS_ERR() on this return value
elsewhere,but I think it can be replaced by the actual error return
value of clk_register.

Signed-off-by: Genjian Zhang <zhanggenjian@kylinos.cn>
---
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..762328de4bce 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 (struct clk_hw *)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 (struct clk_hw *)clk;
+ }
return &psc->hw;
}

--
2.25.1
\
 
 \ /
  Last update: 2022-05-12 10:02    [W:0.046 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site