[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <290ad3d7-eb40-5c60-068f-3835063babc2@users.sourceforge.net>
Date: Wed, 4 Oct 2017 20:50:37 +0200
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-cris-kernel@...s.com,
Alexander Sverdlin <alexander.sverdlin@...il.com>,
Boris Brezillon <boris.brezillon@...e-electrons.com>,
Gregory Clement <gregory.clement@...e-electrons.com>,
Jesper Nilsson <jesper.nilsson@...s.com>,
Krzysztof Halasa <khalasa@...p.pl>,
Mikael Starvik <starvik@...s.com>,
Neil Armstrong <narmstrong@...libre.com>,
Shawn Guo <shawnguo@...nel.org>,
Tony Lindgren <tony@...mide.com>,
Vladimir Zapolskiy <vz@...ia.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 5/5] cris: nand: Split a condition check in
crisv32_nand_flash_probe()
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Wed, 4 Oct 2017 20:02:12 +0200
* Split a condition check for failed calls of the function "ioremap"
so that the return value in the variable "write_cs" will also be
immediately checked.
* Adjust jump targets according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
arch/cris/arch-v32/drivers/mach-fs/nandflash.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
index 2b53f0c615ea..564218a12213 100644
--- a/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
+++ b/arch/cris/arch-v32/drivers/mach-fs/nandflash.c
@@ -113,13 +113,17 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
return NULL;
read_cs = ioremap(MEM_CSP0_START | MEM_NON_CACHEABLE, 8192);
- write_cs = ioremap(MEM_CSP1_START | MEM_NON_CACHEABLE, 8192);
-
- if (!read_cs || !write_cs) {
+ if (!read_cs) {
printk(KERN_ERR "CRISv32 NAND ioremap failed\n");
goto out_mtd;
}
+ write_cs = ioremap(MEM_CSP1_START | MEM_NON_CACHEABLE, 8192);
+ if (!write_cs) {
+ printk(KERN_ERR "CRISv32 NAND ioremap failed\n");
+ goto unmap_read;
+ }
+
/* Get pointer to private data */
this = &wrapper->chip;
crisv32_mtd = nand_to_mtd(this);
@@ -149,13 +153,14 @@ struct mtd_info *__init crisv32_nand_flash_probe(void)
/* Scan to find existence of the device */
if (nand_scan(crisv32_mtd, 1))
- goto out_ior;
+ goto unmap_io;
return crisv32_mtd;
-out_ior:
- iounmap((void *)read_cs);
+unmap_io:
iounmap((void *)write_cs);
+unmap_read:
+ iounmap((void *)read_cs);
out_mtd:
kfree(wrapper);
return NULL;
--
2.14.2
Powered by blists - more mailing lists