From patchwork Sat Sep 23 19:44:15 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: 9967619 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 E6622602CB for ; Sat, 23 Sep 2017 19:44:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D28892915A for ; Sat, 23 Sep 2017 19:44:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C79DC29162; Sat, 23 Sep 2017 19:44:36 +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=unavailable 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 77BD82915A for ; Sat, 23 Sep 2017 19:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751875AbdIWToX (ORCPT ); Sat, 23 Sep 2017 15:44:23 -0400 Received: from mout.web.de ([212.227.15.3]:61813 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751030AbdIWToV (ORCPT ); Sat, 23 Sep 2017 15:44:21 -0400 Received: from [192.168.1.2] ([77.181.226.196]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0LcPRO-1dTd4w3u3a-00jupD; Sat, 23 Sep 2017 21:44:17 +0200 Subject: [PATCH 1/3] [media] camss-csid: Use common error handling code in csid_set_power() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Todor Tomov Cc: LKML , kernel-janitors@vger.kernel.org References: <168ff884-7ace-c548-7f90-d4f2910bb337@users.sourceforge.net> Message-ID: <0fe4e31f-02e2-8b48-c8a8-811ecd8a482f@users.sourceforge.net> Date: Sat, 23 Sep 2017 21:44:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <168ff884-7ace-c548-7f90-d4f2910bb337@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:Guc3T1eOAggYKxUoMwz9CIAN/8s7Am5INmhxbXw9NevmZRPrED0 X+b7dIsGIpW9MzGdj/IRNmSEhHajkrMNoVfeOSkw54whk6Vkqw5wWZT+n7TbUsg/zNxA1pt 0vUOAfjB8QQzs20y0QATZAAsu5gEvl3UpT3+n0nBZ0cPOhnjiII3CNdL83a/YkBifwHH3jX BXmC3sQtaveUnd6gJZ4ZA== X-UI-Out-Filterresults: notjunk:1; V01:K0:opJkAwz6bOA=:eR/rnYCFonNh7iGbvanne8 a9aKS7HCRs80+Y4pVYfCEUUp8tESYkB+sPFsbulEZQ2k74PIj8iFG2rIkbwHNn+v5zdFLioMj S7lnGbRxTKBEdwp2MYUED/YLS8bjOlfdBzYFEoXsql6dQYWANh0gVW/Gt2wdcLT/zXPBruose XPDJLu60Y6as1X5pMTywDouuOFSr5qLryQX4UGZ+q54fssyBNoTfQkap2V1EpUTutgqrEOEj0 KVm6AveNRJezequeZfy5TjOlB2j9SMDaz8nof5axvsJgC+vJjDGPrZ50YZ3RSk2dyCWjvUUen YofEIW/gkGwtHecaPXgjQd0GC08F0DdSWtFgLp+vyq1iscRcJ1bB8+sHDjEBlWqjp/RQZqJyJ ZFnOShO0LE/IKc04zYqHDvIu1xDgiscWGyqyiFAUE69Xz/MzSIPbEQ3mQDtuSg/Lhh7awmdGR F5bXGonR2Yzh60B1pLanuoktu6nC6rYS7k17RIyPPYnMjZOKMGuXh7rvsEpatMKPUNmGxVlF1 Sipchuq+PKOl4wApbpDNPUawhurm3NYxCH+TtIHfo/sADik3o4EvYVadd4qo68WCt8Bs+SavU 8OnczJuga1Pxsrug4yA0tg3xqdK0wIYMlwROF5tydg6ABfNUQoPMwBtQLOkxFglmoxoh9S8ck 0K8MJRMxZnbxkgC7PrFool9EqWSYb/GRRAmZ473UBoEcZGUShczVjLPqqR1QVOEedxEx9Qy6B gTuPx7LMZLD0jZhOq2ZA7WU9WBYRxOX7sH/emwJ+7PUwPk82CrnS8nvsyRdaCk8+sZN/Ke0K2 LVxUZYQz4DOYThKYnrhRZNQt06BS/4Ia4tIh6Jd4MCC7ADI7gg= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Sat, 23 Sep 2017 20:48:33 +0200 Add jump targets 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/media/platform/qcom/camss-8x16/camss-csid.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/qcom/camss-8x16/camss-csid.c b/drivers/media/platform/qcom/camss-8x16/camss-csid.c index 64df82817de3..92d4dc6b4a66 100644 --- a/drivers/media/platform/qcom/camss-8x16/camss-csid.c +++ b/drivers/media/platform/qcom/camss-8x16/camss-csid.c @@ -330,13 +330,9 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) ret = csid_set_clock_rates(csid); - if (ret < 0) { - regulator_disable(csid->vdda); - return ret; - } + if (ret < 0) + goto disable_regulator; ret = camss_enable_clocks(csid->nclocks, csid->clock, dev); - if (ret < 0) { - regulator_disable(csid->vdda); - return ret; - } + if (ret < 0) + goto disable_regulator; enable_irq(csid->irq); @@ -345,8 +341,7 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) if (ret < 0) { disable_irq(csid->irq); camss_disable_clocks(csid->nclocks, csid->clock); - regulator_disable(csid->vdda); - return ret; + goto disable_regulator; } hw_version = readl_relaxed(csid->base + CAMSS_CSID_HW_VERSION); @@ -357,6 +352,11 @@ static int csid_set_power(struct v4l2_subdev *sd, int on) ret = regulator_disable(csid->vdda); } + goto exit; + +disable_regulator: + regulator_disable(csid->vdda); +exit: return ret; }