aboutsummaryrefslogtreecommitdiffstats
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
parentmtd: replace VMLINUX_SYMBOL_STR() with string literal (diff)
downloadlinux-dev-c31106b7af32d845e56acb705f07e187f9b519e6.tar.xz
linux-dev-c31106b7af32d845e56acb705f07e187f9b519e6.zip
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;