1
0
Fork 0

rtc: bq4802: add error handling for devm_ioremap

[ Upstream commit 7874b91986 ]

When devm_ioremap fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling devm_ioremap.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
pull/10/head
Zhouyang Jia 2018-06-12 12:40:03 +08:00 committed by Greg Kroah-Hartman
parent bb2874bba8
commit 8be9576222
1 changed files with 4 additions and 0 deletions

View File

@ -164,6 +164,10 @@ static int bq4802_probe(struct platform_device *pdev)
} else if (p->r->flags & IORESOURCE_MEM) {
p->regs = devm_ioremap(&pdev->dev, p->r->start,
resource_size(p->r));
if (!p->regs){
err = -ENOMEM;
goto out;
}
p->read = bq4802_read_mem;
p->write = bq4802_write_mem;
} else {