From: Zhouyang Jia Date: Fri, 22 Jun 2018 01:52:20 +0000 (+0800) Subject: mtd: maps: gpio-addr-flash: add error handling for ioremap_nocache X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=c31106b7af32d845e56acb705f07e187f9b519e6;p=linux.git mtd: maps: gpio-addr-flash: add error handling for ioremap_nocache When ioremap_nocache fails, the lack of error-handling code may cause unexpected results. This patch adds error-handling code after calling ioremap_nocache. Signed-off-by: Zhouyang Jia Signed-off-by: Boris Brezillon --- diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 385305e66fd1c..9d97236932175 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c @@ -239,6 +239,9 @@ static int gpio_flash_probe(struct platform_device *pdev) state->map.bankwidth = pdata->width; state->map.size = state->win_size * (1 << state->gpio_count); state->map.virt = ioremap_nocache(memory->start, state->map.size); + if (!state->map.virt) + return -ENOMEM; + state->map.phys = NO_XIP; state->map.map_priv_1 = (unsigned long)state;