From patchwork Thu Oct 26 19:50:28 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: 10028759 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 624A060567 for ; Thu, 26 Oct 2017 19:51:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549A328EB5 for ; Thu, 26 Oct 2017 19:51:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46FD528ECA; Thu, 26 Oct 2017 19:51:00 +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 D8F6328ECD for ; Thu, 26 Oct 2017 19:50:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932473AbdJZTus (ORCPT ); Thu, 26 Oct 2017 15:50:48 -0400 Received: from mout.web.de ([217.72.192.78]:60570 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932326AbdJZTup (ORCPT ); Thu, 26 Oct 2017 15:50:45 -0400 Received: from [192.168.1.2] ([78.48.35.118]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LsQTc-1dAZik2iHg-0122de; Thu, 26 Oct 2017 21:50:34 +0200 To: linux-input@vger.kernel.org, Dmitry Torokhov , Haojian Zhuang , Samuel Ortiz From: SF Markus Elfring Subject: [PATCH] Input-max8925_onkey: Use common error handling code in max8925_onkey_probe() Cc: LKML , kernel-janitors@vger.kernel.org Message-ID: Date: Thu, 26 Oct 2017 21:50:28 +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:y4vGlH7jgFNlaCyXSW23SwWiKBn59wbWyPZAzAc0jL3RQWykrVE w4l1r/qEjFH44zJjmtYi0FyqrXnZVojRd+chjvGIu4kRWFCX3Ygf1aZyOknMla1XB5P+7ZX JRTs6ZmUf9GDM3bmZZ2BX2mAbaNTVpHkyyhitUZ33XagWzvuh9E/j2kHkp2/TzBCGVgkFkr glg+DjC5KT/YyiLIIkZtg== X-UI-Out-Filterresults: notjunk:1; V01:K0:bdVrR4N101Y=:dvUj50cnNaFRBAKs1SKikd Q032grsrIeqCxPDEXbqJyTrLjRRbav+dV4jrhHKhzEsr4fGQ/mXkm8YPXJQM9hn0PnO81mds2 8BEXDO7143L91nP2Yj0N+EWm18JxE1eYtyIaIcu3PRNu3ruV04Mz2dFD9cJuLrN42bWzH/Lm8 zeHTe+VQjUDTIgk8IybwjJy87pJp85pA/6BtOW2hRSkjS0UcR4MR/wA5A8rdhA1Yumdae76co esW7okSOlk/qXTNMnq6k7VFCpYyoxp22DTupKb6BY+IgynNHBNln4Exd6yubT9rol3oRNX0M0 LVeYmHqsRC+ldNl++9GiOnPhLKtrDESkz6ZCWUMDElsEZ7PVK1HW7ceVtPxYls5tqjrihHqto afNYaUIIHJRB/kvKkMoRx9UNDXbkOB5s9jmzqmv4ZTFVZHdXwZC0gmg9BluXCTcK6L5GbMdmP gHyBh3W2+FzaVFagEy+adrD7ry3Srx8NDLF5AJRDU9WBH+fUBkyT9dzRNPWDyLyNj52NxKcPe 4No06ByCME6akvhumrfCDQ2EEl23VtB17VgTmlNzKbURnAmzgdCFgg0K9VUXdfo6uD1MIgPeJ wbraUYkSLqTNNofWDfHu4wI9Liif9/W9s5v3cm2fdpv5RdikSAPYsPV59wA4dLP/DDuYZiYdW cPZMWISsxRF1I9rPXGqrVCHQXtTeDqPQblCWVonBKwLcHg2qhOEa9ASKmfEN2ueE4jhtLleo5 tIpiZvuLcEnXpz6xY8ru1AEIlexo0u6GEjcAr23QAh+oekIpioxv2Nz8IwFuv1Mvzq8rGqNI7 7JrWdJhBS2wbUrNa2PdtCZAASBA0FksAHFPBvv919Ln9OVQLkM= Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Thu, 26 Oct 2017 21:40:51 +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/input/misc/max8925_onkey.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/input/misc/max8925_onkey.c b/drivers/input/misc/max8925_onkey.c index 7c49b8d23894..b60b8c2b5acf 100644 --- a/drivers/input/misc/max8925_onkey.c +++ b/drivers/input/misc/max8925_onkey.c @@ -71,16 +71,12 @@ static int max8925_onkey_probe(struct platform_device *pdev) int irq[2], error; irq[0] = platform_get_irq(pdev, 0); - if (irq[0] < 0) { - dev_err(&pdev->dev, "No IRQ resource!\n"); - return -EINVAL; - } + if (irq[0] < 0) + goto report_failure; irq[1] = platform_get_irq(pdev, 1); - if (irq[1] < 0) { - dev_err(&pdev->dev, "No IRQ resource!\n"); - return -EINVAL; - } + if (irq[1] < 0) + goto report_failure; info = devm_kzalloc(&pdev->dev, sizeof(struct max8925_onkey_info), GFP_KERNEL); @@ -131,6 +127,10 @@ static int max8925_onkey_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); return 0; + +report_failure: + dev_err(&pdev->dev, "No IRQ resource!\n"); + return -EINVAL; } static int __maybe_unused max8925_onkey_suspend(struct device *dev)