Skip to content

Commit

Permalink
rtc: pl031: fix resource leak in pl031_probe
Browse files Browse the repository at this point in the history
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
  • Loading branch information
z00448126 authored and alexandrebelloni committed Nov 14, 2020
1 parent bc06cfc commit 1eab0fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/rtc/rtc-pl031.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1eab0fe

Please sign in to comment.