summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZheng Liang <zhengliang6@huawei.com>2020-11-12 17:31:39 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-06 14:56:53 +0100
commitacc3c8cc27a80a6caa0b94e3800d190bbb6af830 (patch)
tree12915528b78041a72d935f1d3a5ecd73c4a48d23
parent26058c397b9f67708d9d8b9207ab005da627c665 (diff)
downloadlinux-stable-acc3c8cc27a80a6caa0b94e3800d190bbb6af830.tar.gz
linux-stable-acc3c8cc27a80a6caa0b94e3800d190bbb6af830.tar.bz2
linux-stable-acc3c8cc27a80a6caa0b94e3800d190bbb6af830.zip
rtc: pl031: fix resource leak in pl031_probe
[ Upstream commit 1eab0fea2514b269e384c117f5b5772b882761f0 ] When devm_rtc_allocate_device is failed in pl031_probe, it should release mem regions with device. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zheng Liang <zhengliang6@huawei.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20201112093139.32566-1-zhengliang6@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/rtc/rtc-pl031.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index c6b89273feba..d4b2ab786126 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -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;