lkml.org 
[lkml]   [2018]   [Jan]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 4/5] mtd/rfd_ftl: Return directly after a failed kmalloc() in erase_block()
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 6 Jan 2018 15:18:28 +0100

* Return directly after a call of the function "kmalloc" failed
at the beginning.

* Delete an initialisation for the variable "rc" and the jump label "err"
which became unnecessary with this refactoring.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mtd/rfd_ftl.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index dcf1b88e1193..e3155ec4be64 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -323,11 +323,11 @@ static void erase_callback(struct erase_info *erase)

static int erase_block(struct partition *part, int block)
{
- int rc = -ENOMEM;
+ int rc;
struct erase_info *erase = kmalloc(sizeof(*erase), GFP_KERNEL);

if (!erase)
- goto err;
+ return -ENOMEM;

erase->mtd = part->mbd.mtd;
erase->callback = erase_callback;
@@ -346,8 +346,6 @@ static int erase_block(struct partition *part, int block)
(unsigned long long)erase->len, part->mbd.mtd->name);
kfree(erase);
}
-
-err:
return rc;
}

--
2.15.1
\
 
 \ /
  Last update: 2018-01-06 16:12    [W:0.052 / U:34.416 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site