[PATCH] rtc: pl031: fix resource leak in pl031_probe

Subsystems: arm/nomadik/ux500 architectures, real time clock (rtc) subsystem, the rest

STALE2090d LANDED

Landed in mainline as 1eab0fea2514 on 2020-11-14.

3 messages, 3 authors, 2020-11-14 · open the first message on its own page

[PATCH] rtc: pl031: fix resource leak in pl031_probe

From: Zheng Liang <hidden>
Date: 2020-11-12 08:35:32

When devm_rtc_allocate_device is failed in pl031_probe, it should release
mem regions with device.

Reported-by: Hulk Robot <redacted>
Signed-off-by: Zheng Liang <redacted>
---
 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 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;
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] rtc: pl031: fix resource leak in pl031_probe

From: Linus Walleij <hidden>
Date: 2020-11-12 12:03:17

On Thu, Nov 12, 2020 at 9:34 AM Zheng Liang [off-list ref] wrote:
When devm_rtc_allocate_device is failed in pl031_probe, it should release
mem regions with device.

Reported-by: Hulk Robot <redacted>
Signed-off-by: Zheng Liang <redacted>
Acked-by: Linus Walleij <redacted>

Yours,
Linus Walleij

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Re: [PATCH] rtc: pl031: fix resource leak in pl031_probe

From: Alexandre Belloni <alexandre.belloni@bootlin.com>
Date: 2020-11-14 22:44:43

On Thu, 12 Nov 2020 17:31:39 +0800, Zheng Liang wrote:
When devm_rtc_allocate_device is failed in pl031_probe, it should release
mem regions with device.
Applied, thanks!

[1/1] rtc: pl031: fix resource leak in pl031_probe
      commit: 1eab0fea2514b269e384c117f5b5772b882761f0

Best regards,
-- 
Alexandre Belloni [off-list ref]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help