mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
rtc: cpcap: kfreeing devm allocated memory
We shouldn't kfree(rtc) because is devm_ managed memory. It leads to a
double free.
Fixes: dd3bf50b35
("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>
This commit is contained in:
parent
7a8128e2e2
commit
65e9e65ceb
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user