Commit 65e9e65c authored by Dan Carpenter's avatar Dan Carpenter Committed by Alexandre Belloni

rtc: cpcap: kfreeing devm allocated memory

We shouldn't kfree(rtc) because is devm_ managed memory.  It leads to a
double free.

Fixes: dd3bf50b ("rtc: cpcap: new rtc driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-By: default avatarSebastian Reichel <sre@kernel.org>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 7a8128e2
...@@ -266,10 +266,8 @@ static int cpcap_rtc_probe(struct platform_device *pdev) ...@@ -266,10 +266,8 @@ static int cpcap_rtc_probe(struct platform_device *pdev)
rtc->rtc_dev = devm_rtc_device_register(dev, "cpcap_rtc", rtc->rtc_dev = devm_rtc_device_register(dev, "cpcap_rtc",
&cpcap_rtc_ops, THIS_MODULE); &cpcap_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc->rtc_dev)) { if (IS_ERR(rtc->rtc_dev))
kfree(rtc);
return PTR_ERR(rtc->rtc_dev); return PTR_ERR(rtc->rtc_dev);
}
err = cpcap_get_vendor(dev, rtc->regmap, &rtc->vendor); err = cpcap_get_vendor(dev, rtc->regmap, &rtc->vendor);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment