summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-04-06 19:01:15 +0200
committerStephen Boyd <sboyd@kernel.org>2021-04-08 01:29:31 +0200
commit657d4d1934f75a2d978c3cf2086495eaa542e7a9 (patch)
treeea0b80a8078fb13ec99317be767fbebccffc989f
parentclk: socfpga: Fix code formatting (diff)
downloadlinux-657d4d1934f75a2d978c3cf2086495eaa542e7a9.tar.xz
linux-657d4d1934f75a2d978c3cf2086495eaa542e7a9.zip
clk: socfpga: arria10: Fix memory leak of socfpga_clk on error return
There is an error return path that is not kfree'ing socfpga_clk leading to a memory leak. Fix this by adding in the missing kfree call. Addresses-Coverity: ("Resource leak") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210406170115.430990-1-colin.king@canonical.com Acked-by: Dinh Nguyen <dinguyen@kernel.org> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-rw-r--r--drivers/clk/socfpga/clk-gate-a10.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/clk/socfpga/clk-gate-a10.c b/drivers/clk/socfpga/clk-gate-a10.c
index f5cba8298712..738c53391e39 100644
--- a/drivers/clk/socfpga/clk-gate-a10.c
+++ b/drivers/clk/socfpga/clk-gate-a10.c
@@ -146,6 +146,7 @@ static void __init __socfpga_gate_init(struct device_node *node,
if (IS_ERR(socfpga_clk->sys_mgr_base_addr)) {
pr_err("%s: failed to find altr,sys-mgr regmap!\n",
__func__);
+ kfree(socfpga_clk);
return;
}
}