summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-cpcap.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-03-14 10:56:30 +0300
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>2017-03-16 23:00:07 +0100
commit65e9e65cebbea755db638875a44b227a1027570e (patch)
tree64dc05fb503498939f9709c97361385d4d724175 /drivers/rtc/rtc-cpcap.c
parent7a8128e2e2aca47ded4347d97585129e19c82451 (diff)
downloadlinux-65e9e65cebbea755db638875a44b227a1027570e.tar.bz2
rtc: cpcap: kfreeing devm allocated memory
We shouldn't kfree(rtc) because is devm_ managed memory. It leads to a double free. Fixes: dd3bf50b35e3 ("rtc: cpcap: new rtc driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-By: Sebastian Reichel <sre@kernel.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Diffstat (limited to 'drivers/rtc/rtc-cpcap.c')
-rw-r--r--drivers/rtc/rtc-cpcap.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-cpcap.c b/drivers/rtc/rtc-cpcap.c
index 7c6a3c3167bd..5d163be98e9f 100644
--- a/drivers/rtc/rtc-cpcap.c
+++ b/drivers/rtc/rtc-cpcap.c
@@ -266,10 +266,8 @@ static int cpcap_rtc_probe(struct platform_device *pdev)
rtc->rtc_dev = devm_rtc_device_register(dev, "cpcap_rtc",
&cpcap_rtc_ops, THIS_MODULE);
- if (IS_ERR(rtc->rtc_dev)) {
- kfree(rtc);
+ if (IS_ERR(rtc->rtc_dev))
return PTR_ERR(rtc->rtc_dev);
- }
err = cpcap_get_vendor(dev, rtc->regmap, &rtc->vendor);
if (err)