From: Yue Haibing <yuehaibing@huawei.com>
To: <michal.simek@xilinx.com>, <daniel.lezcano@linaro.org>,
<tglx@linutronix.de>
Cc: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH] clocksource: cadence_ttc: fix memory leak in ttc_setup_clockevent
Date: Sat, 9 Mar 2019 21:19:58 +0800 [thread overview]
Message-ID: <20190309131958.17996-1-yuehaibing@huawei.com> (raw)
From: YueHaibing <yuehaibing@huawei.com>
Add the missing kfree() in ttc_setup_clockevent() to free the
mem before error return.
Fixes: 70504f311d4b ("clocksource/drivers/cadence_ttc: Convert init function to return error")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/clocksource/timer-cadence-ttc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/clocksource/timer-cadence-ttc.c b/drivers/clocksource/timer-cadence-ttc.c
index b334029..b664af8 100644
--- a/drivers/clocksource/timer-cadence-ttc.c
+++ b/drivers/clocksource/timer-cadence-ttc.c
@@ -432,6 +432,7 @@ static int __init ttc_setup_clockevent(struct clk *clk,
&ttcce->ttc.clk_rate_change_nb);
if (err) {
pr_warn("Unable to register clock notifier.\n");
+ kfree(ttcce);
return err;
}
--
2.7.0
next reply other threads:[~2019-03-09 13:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-09 13:19 Yue Haibing [this message]
2019-03-09 14:24 ` [PATCH] clocksource: cadence_ttc: fix memory leak in ttc_setup_clockevent Daniel Lezcano
2019-03-11 15:47 ` YueHaibing
2019-03-13 13:55 ` Michal Simek
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=20190309131958.17996-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).