From patchwork Sun Nov 5 15:50:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13445731 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F08B9C4332F for ; Sun, 5 Nov 2023 15:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:Subject:From:To:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uqRMkPcfszhGuyYyyPDLSgaln9k2Zx4YvMAuCklBcbU=; b=QLRSkFyEt4gY80 VIi++o/NFXniSE4qjzUJba40fmApvO78gHw3x6kKevNu/quDCvrxJ4juufi0A97sWP4aMK1RxVxKA hDRScOPC5fbTUcFaqA2X29GtiZppXxxwDR37eiFFrtoLzPcRD/JTgAdekmTwBuB9krFcaC+J4wAMG bkjDJ70x627b74aTQEwkK+lmdOhEu6+G36LiFAwVnEmCt8b1JbDOOKS9f+gFWw5n1ggwUWscWIA3q gG7uscmmj0bRKAVuoSvUQouUtuTJyJ7KdJUZVMY4bgfbbE2PYdU778rPagONGVLSfYo4u2ITy4uuG hlyb79EvCMRmWYM+Gztg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qzfON-00F7gq-1Q; Sun, 05 Nov 2023 15:50:27 +0000 Received: from mout.web.de ([212.227.15.3]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qzfOI-00F7f5-2j for linux-arm-kernel@lists.infradead.org; Sun, 05 Nov 2023 15:50:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1699199415; x=1699804215; i=markus.elfring@web.de; bh=r9OwS1ivzSWe+FjftUfNAX167xv+AilwuKPkbzNdkTI=; h=X-UI-Sender-Class:Date:To:From:Subject:Cc; b=QnP4mZKZ+4SYxL2AJg7rZW0ShKW2s2yI9EF29FbrXQsnRTAZSLnlLS6HUoeX2/qZ oP86/tpwDqXhl6mdOFbzyRLTuILXs/R49f3QfuBMOwXBYPxAlIJw79WEUt9QiwtEs 7elI5dSgl9S2nUTXRcXfUwYEQoSsF6bgO0ZiViQ+oW7eoMNQgCFDmtLRjpVGO5+wX bFXEIpXoW909pjT21uaVNZ0f5P0qHX8sqd9ysqQ+AquzpWpkJNTa9VRkql061vPhY XryFxKADTLTAQZtuaemajdosp/ZG3i5wAuXjgJauRSvQVizzyjH6cALLmXeAJhZW1 delpBsohl2Sw8lrlEA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.80.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MEUSE-1rESQG3vh4-00GIYD; Sun, 05 Nov 2023 16:50:15 +0100 Message-ID: Date: Sun, 5 Nov 2023 16:50:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Julia Lawall , Alexandre Belloni , Aubin Constans , Claudiu Beznea , Nicolas Ferre , Ulf Hansson , linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-janitors@vger.kernel.org Content-Language: en-GB From: Markus Elfring Subject: [PATCH] mmc: atmel-mci: Use common error handling code in atmci_of_init() Cc: cocci@inria.fr, LKML X-Provags-ID: V03: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wCv1RE49j3ldVq49Ky1BbYxTkt6I+ZPK vl4tpZQXpt0P1v/Tj7G+ycR013OQBY6uSRjZ6/VRZtulThv5R49UQYJ/XeB5vSDj3lNgV7t1m Dj/eRMdKIN3QzKXhMwWBnrEn71dFKmk2y9NuyD/naS7G32GdJk8u77zdgjCgmPkimaVZa9eH/ ZJelYA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231105_075023_165581_F5DF213C X-CRM114-Status: UNSURE ( 8.76 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Markus Elfring Date: Sun, 5 Nov 2023 16:36:58 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. Signed-off-by: Markus Elfring Acked-by: Aubin Constans --- drivers/mmc/host/atmel-mci.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) -- 2.42.0 diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index dba826db739a..1e83119d1dcb 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -675,10 +675,9 @@ atmci_of_init(struct platform_device *pdev) "cd", GPIOD_IN, "cd-gpios"); err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].detect_pin); if (err) { - if (err != -ENOENT) { - of_node_put(cnp); - return ERR_PTR(err); - } + if (err != -ENOENT) + goto put_node; + pdata->slot[slot_id].detect_pin = NULL; } @@ -690,15 +689,18 @@ atmci_of_init(struct platform_device *pdev) "wp", GPIOD_IN, "wp-gpios"); err = PTR_ERR_OR_ZERO(pdata->slot[slot_id].wp_pin); if (err) { - if (err != -ENOENT) { - of_node_put(cnp); - return ERR_PTR(err); - } + if (err != -ENOENT) + goto put_node; + pdata->slot[slot_id].wp_pin = NULL; } } return pdata; + +put_node: + of_node_put(cnp); + return ERR_PTR(err); } #else /* CONFIG_OF */ static inline struct mci_platform_data*