summaryrefslogtreecommitdiff
path: root/drivers/rtc
diff options
context:
space:
mode:
authorZheng Liang <zhengliang6@huawei.com>2020-11-12 12:31:39 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-11-15 01:42:29 +0300
commit1eab0fea2514b269e384c117f5b5772b882761f0 (patch)
tree6c0af0417dc3bddeac2334c52e446fd16df0a81e /drivers/rtc
parentbc06cfc1c41e3b60b159132e5bba4c059a2e7f83 (diff)
downloadlinux-1eab0fea2514b269e384c117f5b5772b882761f0.tar.xz
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: 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
Diffstat (limited to 'drivers/rtc')
-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;