Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753690AbeAFPLU (ORCPT + 1 other); Sat, 6 Jan 2018 10:11:20 -0500 Received: from mout.web.de ([212.227.15.14]:57962 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753397AbeAFPLT (ORCPT ); Sat, 6 Jan 2018 10:11:19 -0500 Subject: [PATCH 4/5] mtd/rfd_ftl: Return directly after a failed kmalloc() in erase_block() From: SF Markus Elfring To: linux-mtd@lists.infradead.org, Boris Brezillon , Brian Norris , Cyrille Pitchen , David Woodhouse , Marek Vasut , Richard Weinberger Cc: LKML , kernel-janitors@vger.kernel.org References: Message-ID: <7b381eef-c54f-d2c9-7281-a90d519c22f1@users.sourceforge.net> Date: Sat, 6 Jan 2018 16:10:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:F7JGxL3M42F4E7pULqa8dQapOf/q99MYq8W4cfdwRbexVqhKfV6 wrlWybuqNbjd52MaTp88GSVnKxRTE6WZQcvJ1qYQtC/M5uw56unEIC6Nml74S3+NpnMF1UA FQkMnwNjEzIsxqIRgVXa5q2SaJlwPWC324+YFeqgS63qG1T2M8LUgxPG0FRnrsXUROfhMgZ RXizVXSA9zp+UDiamtLPg== X-UI-Out-Filterresults: notjunk:1;V01:K0:LbwBnzPeB10=:wDP/t4lVn321Oljz7XaBCJ QPvVfNf/AzQWbGDQ7+NkEJEAzuaLb1W3cZw7YKYSRSR9lAKLknCNdlNHVGrMh/rydows389t1 98GwjWiwRquIj0mhOq7ct3FAj6FrlJU9hK6qjdMZOqXasFXMiLvlHgtcRR6QDi7wNibebxBIC v5y3R370xp3o1SvLRpvZSWVmDP4uS1zVaXxh/veqxMC1/+0WaP4ei7DsJw6q7iLJq/4uxthQH xNhmGQYYrhBqn4B3dK1I0dvVzY2ETjmozcltENkdarr+R7I2/ApSAh05hFlVPtnBcB5hLbUQE gGMLeDOMMPT1c8ODukCdutToyv7x3jeFt99sfG5P4OW2u4eJ4JNJ9V71DTI25lDp439M+5Tw6 r40PkPfqCrJVEv5hJusZvvhlolDMKAS7sIQ0ljOkirnO6xwOF3QobYjyCUaJsTFlRwzm09DPW w6EMJwkgH+Op0tSajxjcQuaPd9EwnIwrAvJRFiIkoA/zC29k9j6diChdNVGz1rwUXwml/H21b 0Ej6L4R69dh4FVWM3ArFmAsWcuhM/o+wBOAvkuOhwkYbR1nJ0KAHrtPNLiCh0FkrofZxVkZsr bmzU7iQoYtyaviela5vlyM4z2jG8KLdE1ZmfbZazHAE7V/STo3XLC9VTH6oOJ1bIO8eCw0dY1 KJYmQhZKnLWXbnMWiz6KffdvG9OKpRNV59u/wzRUMJH/f67SAxuCPmyim+fCimqbD3WtUhcg/ QJZValXH1lPY+NIEWsQfWyHrOVu/GtN6Ih9he8UPwUU3MrewkaF0WKlZSDQf6QI1zs6XImFKE l8SpHQGYrUD4+I5eouTJ3eyeZK0Xqu+iRz+gRTrbBU/G07Mb7U= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring 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 --- 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