[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201230130314.3636961-5-sashal@kernel.org>
Date: Wed, 30 Dec 2020 08:02:47 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Zheng Liang <zhengliang6@...wei.com>,
Hulk Robot <hulkci@...wei.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Linus Walleij <linus.walleij@...aro.org>,
Sasha Levin <sashal@...nel.org>,
linux-arm-kernel@...ts.infradead.org, linux-rtc@...r.kernel.org
Subject: [PATCH AUTOSEL 5.10 05/31] rtc: pl031: fix resource leak in pl031_probe
From: Zheng Liang <zhengliang6@...wei.com>
[ 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@...wei.com>
Signed-off-by: Zheng Liang <zhengliang6@...wei.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@...tlin.com>
Acked-by: Linus Walleij <linus.walleij@...aro.org>
Link: https://lore.kernel.org/r/20201112093139.32566-1-zhengliang6@huawei.com
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/rtc/rtc-pl031.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index c6b89273feba8..d4b2ab7861266 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;
--
2.27.0
Powered by blists - more mailing lists