[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f10248e-d2c9-3c48-922c-be95ac5caba9@users.sourceforge.net>
Date: Sat, 6 Jan 2018 16:08:51 +0100
From: SF Markus Elfring <elfring@...rs.sourceforge.net>
To: linux-mtd@...ts.infradead.org,
Boris Brezillon <boris.brezillon@...e-electrons.com>,
Brian Norris <computersforpeace@...il.com>,
Cyrille Pitchen <cyrille.pitchen@...ev4u.fr>,
David Woodhouse <dwmw2@...radead.org>,
Marek Vasut <marek.vasut@...il.com>,
Richard Weinberger <richard@....at>
Cc: LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH 2/5] mtd/rfd_ftl: Less function calls in scan_header() after
error detection
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Sat, 6 Jan 2018 14:50:58 +0100
The functions "kfree" and "vfree" were called in three cases
by the scan_header() function during error handling even if
the passed data structure member contained a null pointer.
Adjust jump targets according to the Linux coding style convention.
Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
---
drivers/mtd/rfd_ftl.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index efff25f15d5b..19e14f909dc6 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -182,16 +182,16 @@ static int scan_header(struct partition *part)
part->header_cache = kmalloc(part->header_size, GFP_KERNEL);
if (!part->header_cache)
- goto err;
+ return -ENOMEM;
part->blocks = kcalloc(part->total_blocks, sizeof(struct block),
GFP_KERNEL);
if (!part->blocks)
- goto err;
+ goto free_cache;
part->sector_map = vmalloc(part->sector_count * sizeof(u_long));
if (!part->sector_map)
- goto err;
+ goto free_blocks;
for (i=0; i<part->sector_count; i++)
part->sector_map[i] = -1;
@@ -229,9 +229,10 @@ static int scan_header(struct partition *part)
err:
vfree(part->sector_map);
- kfree(part->header_cache);
+free_blocks:
kfree(part->blocks);
-
+free_cache:
+ kfree(part->header_cache);
return rc;
}
--
2.15.1
Powered by blists - more mailing lists