From patchwork Mon Oct 30 18:36:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 10033025 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E7407600C5 for ; Mon, 30 Oct 2017 18:37:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB06527DCD for ; Mon, 30 Oct 2017 18:37:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CC5B4288A1; Mon, 30 Oct 2017 18:37:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5871127DCD for ; Mon, 30 Oct 2017 18:37:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:Subject: From:To: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=j+lDhIcjCWi8ujhfa2Q0EzQQCEVY7pmQddrtXsNhRd0=; b=j9u5hQj6bESqqj pmzbuY4Xkoh/DdJRlm5P3kIfOZj/SlB4zrYj4yheg7RzwDnb7dSZvZ3XX5qNlPXs2paRK6kKSsQQF zGOj+1WSHlP8DtSECTf8/Ma+rKIF9OWyd4Cfl/IBI5SOR7K0fK8OEEnu8cDTUPJdRH4CtJrKvkYkh +OuWEB8bURLPtP4jdU7wIF2t7wPDpvAjj3eEGT9UlsNc7VatiFfG1n258kXRr8xw8YuOaT2Kul6nm Wh+Mj8lOUBoz2uyyAUiswg/8VcTNxXBg5GmPxxgmbUQx2/nbkRrsYxiTfuLTeFJkpiI4d+M5H6WUh oJ7UUbvZ5mGXdiywrwRA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e9Ew5-0004XT-He; Mon, 30 Oct 2017 18:37:21 +0000 Received: from mout.web.de ([212.227.17.11]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e9Evy-0004VQ-6h for linux-arm-kernel@lists.infradead.org; Mon, 30 Oct 2017 18:37:19 +0000 Received: from [192.168.1.2] ([77.181.252.76]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LshSX-1dBbwx2AaP-012JV3; Mon, 30 Oct 2017 19:36:42 +0100 To: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Barry Song , Geert Uytterhoeven , Julia Lawall , Krzysztof Kozlowski , Linus Walleij , Ludovic Desroches , Patrice Chotard , Rob Herring From: SF Markus Elfring Subject: [PATCH] pinctrl: sirf: Use common error handling code in sirfsoc_dt_node_to_map() Message-ID: <80911d4b-d819-335c-106e-70d7672e645b@users.sourceforge.net> Date: Mon, 30 Oct 2017 19:36:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:PWbsz3JnHkQxJVGePwvFoY2ocAF6u4/NzgG4tCZMo06lyZ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FvE4= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171030_113718_289043_1C2C6B9F X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 30 Oct 2017 19:26:56 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/pinctrl/sirf/pinctrl-sirf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/pinctrl/sirf/pinctrl-sirf.c b/drivers/pinctrl/sirf/pinctrl-sirf.c index d64add0b84cc..5ec2f37f5180 100644 --- a/drivers/pinctrl/sirf/pinctrl-sirf.c +++ b/drivers/pinctrl/sirf/pinctrl-sirf.c @@ -89,16 +89,12 @@ static int sirfsoc_dt_node_to_map(struct pinctrl_dev *pctldev, /* calculate number of maps required */ for_each_child_of_node(np_config, np) { ret = of_property_read_string(np, "sirf,function", &function); - if (ret < 0) { - of_node_put(np); - return ret; - } + if (ret < 0) + goto put_node; ret = of_property_count_strings(np, "sirf,pins"); - if (ret < 0) { - of_node_put(np); - return ret; - } + if (ret < 0) + goto put_node; count += ret; } @@ -125,6 +121,10 @@ static int sirfsoc_dt_node_to_map(struct pinctrl_dev *pctldev, *num_maps = count; return 0; + +put_node: + of_node_put(np); + return ret; } static void sirfsoc_dt_free_map(struct pinctrl_dev *pctldev,