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>
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)