projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0049eb1
)
clk: imx: scu: fix memleak on platform_device_add() fails
author
Lin Yujun
<linyujun809@huawei.com>
Wed, 14 Sep 2022 03:32:06 +0000
(11:32 +0800)
committer
Stephen Boyd
<sboyd@kernel.org>
Sat, 1 Oct 2022 00:06:59 +0000
(17:06 -0700)
No error handling is performed when platform_device_add()
fails. Add error processing before return, and modified
the return value.
Fixes:
77d8f3068c63
("clk: imx: scu: add two cells binding support")
Signed-off-by: Lin Yujun <linyujun809@huawei.com>
Link:
https://lore.kernel.org/r/20220914033206.98046-1-linyujun809@huawei.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
drivers/clk/imx/clk-scu.c
patch
|
blob
|
history
diff --git
a/drivers/clk/imx/clk-scu.c
b/drivers/clk/imx/clk-scu.c
index
c56e406
..
1e6870f
100644
(file)
--- a/
drivers/clk/imx/clk-scu.c
+++ b/
drivers/clk/imx/clk-scu.c
@@
-695,7
+695,11
@@
struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
pr_warn("%s: failed to attached the power domain %d\n",
name, ret);
- platform_device_add(pdev);
+ ret = platform_device_add(pdev);
+ if (ret) {
+ platform_device_put(pdev);
+ return ERR_PTR(ret);
+ }
/* For API backwards compatiblilty, simply return NULL for success */
return NULL;