From patchwork Wed Oct 25 09:52: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: 830188 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-i2c-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3yMQRn6WSNz9sRV for ; Wed, 25 Oct 2017 20:52:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932333AbdJYJwi (ORCPT ); Wed, 25 Oct 2017 05:52:38 -0400 Received: from mout.web.de ([212.227.15.14]:54625 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932315AbdJYJwh (ORCPT ); Wed, 25 Oct 2017 05:52:37 -0400 Received: from [192.168.1.2] ([77.181.217.114]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LsyOA-1dAXZC0Jq6-012bTO; Wed, 25 Oct 2017 11:52:32 +0200 To: linux-i2c@vger.kernel.org, David Daney , Jan Glauber , Wolfram Sang Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] I2C-Octeon: Use common error handling code in octeon_i2c_probe() Message-ID: <73affb84-9cdd-9f5c-b96a-5a392739e789@users.sourceforge.net> Date: Wed, 25 Oct 2017 11:52: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:pn5E9J/7DL1ej6JtTvIiTynxxozoc9wr6XrtXV7rmBtNTJQe7ld RdyahM3YvYV6pkCPSOvWLhFq4Dji4uW6chbVdsZIWMKTlPjNsBXrF1QKEvsgf3ATB1U9GMj I3YisK18yOO3Sx142ohq0SFfy4ER2rBAV9NxZZ6qaSBSyMoY2zFDPOs2yjWKdZMxIp47sG3 LI3X7fwyqsdKfGC7qUocg== X-UI-Out-Filterresults: notjunk:1; V01:K0:m0XolosSuCU=:a9Dg/x5lqib9M8GboU6LYD tp1/1yUoYhdvJnDKEPRGMihzfyv8GzRJ7qjdQgMqFgB2x06+vlAnAexevzwrL5Zj53zlAaoHQ prMVlxTkGEqOj9axD95MmunLMQfIquG9kEUFwL021n1S1oCl7JSg9zyWRT+SL+MzeB2b4+goF Ct1plXl5v67B0lizufN44nqGAzOo1VOlpvur5zz02TU4t9AEHqvq88Vn7X8SB11gpCrvS/Xuz iDaJMYyv+mYejSJpaP9qhU8JfHuwJZ/ij82qDD0mKwxsthY+Ogjhk799O2PRtz3pqLoPmAEBd djD3UiS2ngyjz010tsM4JWcybJV++lmATkDMLQmcB7597zR1s9OKjMz81mUG+ekuqJht/zOSP MdmKdUn5iGZZnx2YQGTTb6uDFVnrka2yfUTTfM0tVwU9BqG2EJP8ByzrRsdcpbo/sBqn6anLB leKwZarAMCAIuljFoES5/INAvl8ccdF3Adv2f1Vp6C9Ri6uKLdkkFt5Bep0KaU9GCJB3UzxYQ aLCKdhb7jBrl+OEEzSG2vS7bn1TAEpd23eP6BdlPi96N1Z0JbznY6RLwTU0mN6bd7Wta6T2cU 5eAibV+0gCzXxoVJYSQIe7njB7vnVpZ2TFmnTL8pTkMN76DOa2enK18K/iIr+9b4wGhf8CCqi z5DcMF3j0nN8YzF8jYXTUNwoWHMZRq/nabIWP4MYFSXkbySFTmz5mebaFFQ3f+qNZG4h59VLh FNv627x+iRyIL3pbeRLMYTUpCAc1XJQpItjYnPte09BOMFCcP1TiqQQvtEuqF8uSMKnJlCb+P g+ISn15nrf0jV3uTiAuAmPdwO36bWoScUZ13Z3KYEG12Qi6juA= Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org From: Markus Elfring Date: Wed, 25 Oct 2017 11:45:48 +0200 Add a jump target so that a specific error message is stored only once at the end of this function implementation. Replace two calls of the function "dev_err" by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/i2c/busses/i2c-octeon-platdrv.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-octeon-platdrv.c b/drivers/i2c/busses/i2c-octeon-platdrv.c index 64bda83e65ac..ac8a1099c523 100644 --- a/drivers/i2c/busses/i2c-octeon-platdrv.c +++ b/drivers/i2c/busses/i2c-octeon-platdrv.c @@ -207,10 +207,8 @@ static int octeon_i2c_probe(struct platform_device *pdev) result = devm_request_irq(&pdev->dev, i2c->hlc_irq, octeon_i2c_hlc_isr78, 0, DRV_NAME, i2c); - if (result < 0) { - dev_err(i2c->dev, "failed to attach interrupt\n"); - goto out; - } + if (result < 0) + goto report_failure; } else { i2c->int_enable = octeon_i2c_int_enable; i2c->int_disable = octeon_i2c_int_disable; @@ -220,10 +218,8 @@ static int octeon_i2c_probe(struct platform_device *pdev) result = devm_request_irq(&pdev->dev, i2c->irq, octeon_i2c_isr, 0, DRV_NAME, i2c); - if (result < 0) { - dev_err(i2c->dev, "failed to attach interrupt\n"); - goto out; - } + if (result < 0) + goto report_failure; if (OCTEON_IS_MODEL(OCTEON_CN38XX)) i2c->broken_irq_check = true; @@ -251,6 +247,8 @@ static int octeon_i2c_probe(struct platform_device *pdev) dev_info(i2c->dev, "probed\n"); return 0; +report_failure: + dev_err(i2c->dev, "failed to attach interrupt\n"); out: return result; };