Commit 1eab0fea authored by Zheng Liang's avatar Zheng Liang Committed by Alexandre Belloni

rtc: pl031: fix resource leak in pl031_probe

When devm_rtc_allocate_device is failed in pl031_probe, it should release
mem regions with device.
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Signed-off-by: default avatarZheng Liang <zhengliang6@huawei.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20201112093139.32566-1-zhengliang6@huawei.com
parent bc06cfc1
......@@ -361,8 +361,10 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
device_init_wakeup(&adev->dev, true);
ldata->rtc = devm_rtc_allocate_device(&adev->dev);
if (IS_ERR(ldata->rtc))
return PTR_ERR(ldata->rtc);
if (IS_ERR(ldata->rtc)) {
ret = PTR_ERR(ldata->rtc);
goto out;
}
ldata->rtc->ops = ops;
ldata->rtc->range_min = vendor->range_min;
......
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