From patchwork Fri Dec 18 19:39:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 559056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 92ED6140213 for ; Sat, 19 Dec 2015 06:41:54 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=n5OEPttn; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aA0t7-0002p4-Es; Fri, 18 Dec 2015 19:40:25 +0000 Received: from mail-pa0-x22d.google.com ([2607:f8b0:400e:c03::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aA0t5-0001n1-86 for linux-mtd@lists.infradead.org; Fri, 18 Dec 2015 19:40:23 +0000 Received: by mail-pa0-x22d.google.com with SMTP id ur14so64899450pab.0 for ; Fri, 18 Dec 2015 11:40:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=60HTnIv+ulotO6uXvYdDIk1FJ4eDjPhSwlmXaRCOFMg=; b=n5OEPttnEY6hSyA3owTRsAQmUkHniAtvLU8pkAeiceZwamj5aWGa3sYWWfkWq3PHpn iSjZ+rxwiYWNSK/rXt/RF+3YwAFPzoqERFZT3+wMFzvdSgFWjWv8+/1mZWzwkq/UP5S1 fmNrQfILh8ME37hz1OPgrAmx+Izgod7r0hfB0ZRtXjAdx4TsRZXLumfDQsJ9Il4e8t2i vxynxZl7gQYYX+7Vo7cPw6szHSN3GD/eKSY9fSHao/Ty5I+oC7VID66B7V+RdFdPIEnM ajGtZa9JmHITF1nd0ogw0Uyx+j58GwAM8cQfIqcjxfWyVGK9k/wpXm6LC3O6bCt6+0qP KapQ== X-Received: by 10.66.139.234 with SMTP id rb10mr7750263pab.82.1450467602559; Fri, 18 Dec 2015 11:40:02 -0800 (PST) Received: from ban.mtv.corp.google.com ([172.22.64.120]) by smtp.gmail.com with ESMTPSA id z65sm82857pfa.63.2015.12.18.11.40.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 Dec 2015 11:40:01 -0800 (PST) From: Brian Norris To: Subject: [PATCH] mtd: nand: docg4: simplify error case Date: Fri, 18 Dec 2015 11:39:53 -0800 Message-Id: <1450467593-90957-1-git-send-email-computersforpeace@gmail.com> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151218_114023_343757_35D19336 X-CRM114-Status: UNSURE ( 9.31 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c03:0:0:0:22d listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (computersforpeace[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Boris Brezillon , Brian Norris MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Other refactorings have left the 'fail' label much simpler, so it shouldn't have to handle the failed allocation case. This also fixes a -Wshadow warning. Signed-off-by: Brian Norris Reviewed-by: Boris Brezillon --- drivers/mtd/nand/docg4.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c index cb6efadd712e..24d478d90dcc 100644 --- a/drivers/mtd/nand/docg4.c +++ b/drivers/mtd/nand/docg4.c @@ -1353,14 +1353,10 @@ static int __init probe_docg4(struct platform_device *pdev) doc->mtd = mtd; return 0; - fail: - if (nand) { - /* re-declarations avoid compiler warning */ - struct docg4_priv *doc = nand->priv; - nand_release(mtd); /* deletes partitions and mtd devices */ - free_bch(doc->bch); - kfree(nand); - } +fail: + nand_release(mtd); /* deletes partitions and mtd devices */ + free_bch(doc->bch); + kfree(nand); fail_unmap: iounmap(virtadr);