From patchwork Sun Oct 22 12:16:53 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: 10021687 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 C8CA360234 for ; Sun, 22 Oct 2017 12:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2B53286B7 for ; Sun, 22 Oct 2017 12:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A58A8287C5; Sun, 22 Oct 2017 12:17:18 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CD82F286B7 for ; Sun, 22 Oct 2017 12:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750740AbdJVMRP (ORCPT ); Sun, 22 Oct 2017 08:17:15 -0400 Received: from mout.web.de ([217.72.192.78]:56134 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750736AbdJVMRO (ORCPT ); Sun, 22 Oct 2017 08:17:14 -0400 Received: from [192.168.1.2] ([77.182.45.221]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LtFYd-1d5EYt3XMh-012nAX; Sun, 22 Oct 2017 14:16:56 +0200 To: linux-crypto@vger.kernel.org, "David S. Miller" , Gary Hook , Herbert Xu , Tom Lendacky Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] crypto-ccp: Use common error handling code in sp_get_irqs() Message-ID: <0abcf065-56e9-dd3c-e210-0b0c21828a84@users.sourceforge.net> Date: Sun, 22 Oct 2017 14:16:53 +0200 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:E/LM7kxxduKoGVJ5BNBjU61Vqwv9e4e12grjINMMjK8qJlzZnUY Aa/kxb7fZC/BPV1lJuvwa1aW/B9Z4Et9O2UwqGHqaud1YodpR/nMSOwpP2Z9eyAN72X1f9M 3rLwsJTo8lDWXKTAATsvbvcCkMpJ2teg8vBhWP39H07jUBisDYSX8DAJqYbQGX5ICHqH44U LwMX679TFBUMva3RKK3Iw== X-UI-Out-Filterresults: notjunk:1; V01:K0:vM5Z9ZI5suM=:eMPJ6jSdJFN7E0hfzlGLge TK21VWdZjxrYWuaehOz0/pPVWaQXo3WKGiGWCIy9Fy3gKpbqOryl7UXi/vQIlJ3Vq/856TWe4 MTtv+hBjhZBD8fo9FCP4KU5Rx8mZW9iZw62vpUhW3xZRnTXtRojbbaXkvFrJoYdHZ+lvu9pBb nqHOFqKlbK/ea7K+5OvrOrDxdYbf2jeeiVwau3u6X1WHOEjUQlNwIvLtfmhuwq3psooYy/Oc7 q8MTk2X53FrXarQBgmlqD0YwIkofHu95OWUCW34CdGt0wFx1FVa5/7OdR3EkE1o03hWdl3VZ2 e7k/NtI4toYVVeS91Ygq+YAHPh9C0LbJ16uyRP4vyJjOUeBjEa3ctv2Sn1cgUTIOMr2Awj7es Yb+rw4ysDcgLm9Pr8iI2d+cw56XMHkxUVFt9oS6etdTGE5xE5BuFri2WZKvVEj23MilC2AC/A 6/g14v5ml3QrVqwY8txvWaFvj9wN+CkQ/FZDEeyhAgiCpF+JA+6PVXG/zmxzv8lH/67KCyNVp g+i8aHdT20hNKtewN6uuPNnfKR+PR+XNXnBklWskdmCh1valZmLIzmDfbzvz7IVrSDIzQYblR D0Xuy4kpw1u1ObwgHgP+z8i8U7+9XGuVGd2jxQa1gNQ9Gv6z84jSDaha/NMxNb52CvuK4o00P PhDlcnFf2thjAVM1FA2g4ouq3b0MMTZy1eHKOzyd8z6XejlH8drvhQ5pjZWiRCrw3SkCUgxDh dvlTSeoODrw0xnPKDVmskPGE4tnyglFj0cU+NBceh6uipEYt4+t283oreTGCTBaDWNah4GTJk 5K1EnyVqqMOq5GQxtiMtTH4jvBZ/WE53yqnv3wNJkZBFiFbqfg= Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sun, 22 Oct 2017 14:10:33 +0200 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/crypto/ccp/sp-platform.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c index 71734f254fd1..7d7670c7484a 100644 --- a/drivers/crypto/ccp/sp-platform.c +++ b/drivers/crypto/ccp/sp-platform.c @@ -78,25 +78,25 @@ static int sp_get_irqs(struct sp_device *sp) sp_platform->irq_count = count; ret = platform_get_irq(pdev, 0); - if (ret < 0) { - dev_notice(dev, "unable to get IRQ (%d)\n", ret); - return ret; - } + if (ret < 0) + goto report_failure; sp->psp_irq = ret; if (count == 1) { sp->ccp_irq = ret; } else { ret = platform_get_irq(pdev, 1); - if (ret < 0) { - dev_notice(dev, "unable to get IRQ (%d)\n", ret); - return ret; - } + if (ret < 0) + goto report_failure; sp->ccp_irq = ret; } return 0; + +report_failure: + dev_notice(dev, "unable to get IRQ (%d)\n", ret); + return ret; } static int sp_platform_probe(struct platform_device *pdev)