From: Yuan Can <yuancan@huawei.com>
To: <pdeschrijver@nvidia.com>, <pgaikwad@nvidia.com>,
<mturquette@baylibre.com>, <sboyd@kernel.org>,
<thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
<mperttunen@nvidia.com>, <tomeu.vizoso@collabora.com>,
<linux-clk@vger.kernel.org>, <linux-tegra@vger.kernel.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH] clk: tegra: tegra124-emc: Fix potential memory leak
Date: Fri, 9 Dec 2022 09:41:24 +0000 [thread overview]
Message-ID: <20221209094124.71043-1-yuancan@huawei.com> (raw)
The tegra and tegra needs to be freed in the error handling path, otherwise
it will be leaked.
Fixes: 2db04f16b589 ("clk: tegra: Add EMC clock driver")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
drivers/clk/tegra/clk-tegra124-emc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/clk/tegra/clk-tegra124-emc.c b/drivers/clk/tegra/clk-tegra124-emc.c
index 219c80653dbd..2a6db0434281 100644
--- a/drivers/clk/tegra/clk-tegra124-emc.c
+++ b/drivers/clk/tegra/clk-tegra124-emc.c
@@ -464,6 +464,7 @@ static int load_timings_from_dt(struct tegra_clk_emc *tegra,
err = load_one_timing_from_dt(tegra, timing, child);
if (err) {
of_node_put(child);
+ kfree(tegra->timings);
return err;
}
@@ -515,6 +516,7 @@ struct clk *tegra124_clk_register_emc(void __iomem *base, struct device_node *np
err = load_timings_from_dt(tegra, node, node_ram_code);
if (err) {
of_node_put(node);
+ kfree(tegra);
return ERR_PTR(err);
}
}
--
2.17.1
next reply other threads:[~2022-12-09 9:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-09 9:41 Yuan Can [this message]
2023-02-10 23:23 ` [PATCH] clk: tegra: tegra124-emc: Fix potential memory leak Stephen Boyd
2023-04-05 12:38 ` Thierry Reding
2023-06-15 1:26 ` Stephen Boyd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221209094124.71043-1-yuancan@huawei.com \
--to=yuancan@huawei.com \
--cc=jonathanh@nvidia.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=mperttunen@nvidia.com \
--cc=mturquette@baylibre.com \
--cc=pdeschrijver@nvidia.com \
--cc=pgaikwad@nvidia.com \
--cc=sboyd@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tomeu.vizoso@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox