linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtc: pl031: fix resource leak in pl031_probe
@ 2020-11-12  9:31 Zheng Liang
  2020-11-12 12:01 ` Linus Walleij
  2020-11-14 22:43 ` Alexandre Belloni
  0 siblings, 2 replies; 3+ messages in thread
From: Zheng Liang @ 2020-11-12  9:31 UTC (permalink / raw)
  To: linus.walleij
  Cc: linux-rtc, a.zummo, alexandre.belloni, zhengliang6, fangwei1,
	wangli74, linux-arm-kernel

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>
---
 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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: pl031: fix resource leak in pl031_probe
  2020-11-12  9:31 [PATCH] rtc: pl031: fix resource leak in pl031_probe Zheng Liang
@ 2020-11-12 12:01 ` Linus Walleij
  2020-11-14 22:43 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2020-11-12 12:01 UTC (permalink / raw)
  To: Zheng Liang
  Cc: linux-rtc, Alessandro Zummo, Alexandre Belloni, fangwei1,
	wangli74, Linux ARM

On Thu, Nov 12, 2020 at 9:34 AM Zheng Liang <zhengliang6@huawei.com> wrote:

> 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>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rtc: pl031: fix resource leak in pl031_probe
  2020-11-12  9:31 [PATCH] rtc: pl031: fix resource leak in pl031_probe Zheng Liang
  2020-11-12 12:01 ` Linus Walleij
@ 2020-11-14 22:43 ` Alexandre Belloni
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2020-11-14 22:43 UTC (permalink / raw)
  To: Zheng Liang, linus.walleij
  Cc: linux-rtc, a.zummo, Alexandre Belloni, fangwei1, wangli74,
	linux-arm-kernel

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 <alexandre.belloni@bootlin.com>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-14 22:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-12  9:31 [PATCH] rtc: pl031: fix resource leak in pl031_probe Zheng Liang
2020-11-12 12:01 ` Linus Walleij
2020-11-14 22:43 ` Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).