summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorZhouyang Jia <jiazhouyang09@gmail.com>2018-06-22 09:52:20 +0800
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-07-07 10:48:36 +0200
commitc31106b7af32d845e56acb705f07e187f9b519e6 (patch)
treeaa21939252693ea7a096bd0c689461e52f2d5579 /drivers/mtd/maps
parent7a1f1b594a3d102f3766b9866aa081f5480c0be0 (diff)
downloadlinux-c31106b7af32d845e56acb705f07e187f9b519e6.tar.bz2
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 <jiazhouyang09@gmail.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/gpio-addr-flash.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
index 385305e66fd1..9d9723693217 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;