diff options
| author | Zheng Liang <zhengliang6@huawei.com> | 2020-11-12 17:31:39 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-06 14:48:39 +0100 |
| commit | a95049c51417522b466ce4fcdfd6668afe226938 (patch) | |
| tree | 1ac6bfa73cdfc098c7a778990d3fdaee9a063840 /drivers/rtc | |
| parent | e2926630f6539b6809547ae51a878d0f3d8cb74e (diff) | |
| download | linux-a95049c51417522b466ce4fcdfd6668afe226938.tar.gz linux-a95049c51417522b466ce4fcdfd6668afe226938.tar.bz2 linux-a95049c51417522b466ce4fcdfd6668afe226938.zip | |
rtc: pl031: fix resource leak in pl031_probe
[ 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@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
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-pl031.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c index 180caebbd355..9566958476df 100644 --- a/drivers/rtc/rtc-pl031.c +++ b/drivers/rtc/rtc-pl031.c @@ -379,8 +379,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; |
