summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2019-10-02 10:53:09 +0200
committerSeung-Woo Kim <sw0312.kim@samsung.com>2019-10-08 10:53:10 +0000
commitee9bfe5eb9de9aafcc76d3e89534ca6d3bbef85f (patch)
tree22b8dcc121781339b647ce3d8a920358c01a88d9 /drivers
parent40ccc9b3cc77dfbeb3f0939e30dec0c248658f28 (diff)
downloadlinux-exynos-ee9bfe5eb9de9aafcc76d3e89534ca6d3bbef85f.tar.gz
linux-exynos-ee9bfe5eb9de9aafcc76d3e89534ca6d3bbef85f.tar.bz2
linux-exynos-ee9bfe5eb9de9aafcc76d3e89534ca6d3bbef85f.zip
clk: samsung: exynos5433: Fix error paths
Add checking the value returned by samsung_clk_alloc_reg_dump() and devm_kcalloc(). While fixing this, also release all gathered clocks. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Change-Id: I08e35e458e51f07e4c05c4101ffb4b86d187aded
Diffstat (limited to 'drivers')
-rw-r--r--drivers/clk/samsung/clk-exynos5433.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/clk/samsung/clk-exynos5433.c b/drivers/clk/samsung/clk-exynos5433.c
index 32ef8d6161ea..01ead7ea7d36 100644
--- a/drivers/clk/samsung/clk-exynos5433.c
+++ b/drivers/clk/samsung/clk-exynos5433.c
@@ -5675,6 +5675,8 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
data->clk_save = samsung_clk_alloc_reg_dump(info->clk_regs,
info->nr_clk_regs);
+ if (!data->clk_save)
+ return -ENOMEM;
data->nr_clk_save = info->nr_clk_regs;
data->clk_suspend = info->suspend_regs;
data->nr_clk_suspend = info->nr_suspend_regs;
@@ -5683,12 +5685,19 @@ static int __init exynos5433_cmu_probe(struct platform_device *pdev)
if (data->nr_pclks > 0) {
data->pclks = devm_kcalloc(dev, sizeof(struct clk *),
data->nr_pclks, GFP_KERNEL);
-
+ if (!data->pclks) {
+ kfree(data->clk_save);
+ return -ENOMEM;
+ }
for (i = 0; i < data->nr_pclks; i++) {
struct clk *clk = of_clk_get(dev->of_node, i);
- if (IS_ERR(clk))
+ if (IS_ERR(clk)) {
+ kfree(data->clk_save);
+ while (--i >= 0)
+ clk_put(data->pclks[i]);
return PTR_ERR(clk);
+ }
data->pclks[i] = clk;
}
}