From patchwork Tue Sep 26 11:27:47 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: 9971739 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 35CAA602BD for ; Tue, 26 Sep 2017 11:28:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 371FC289A2 for ; Tue, 26 Sep 2017 11:28:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2BC9228A78; Tue, 26 Sep 2017 11:28:07 +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 29F95289A2 for ; Tue, 26 Sep 2017 11:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965476AbdIZL1z (ORCPT ); Tue, 26 Sep 2017 07:27:55 -0400 Received: from mout.web.de ([212.227.17.11]:57585 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934463AbdIZL1x (ORCPT ); Tue, 26 Sep 2017 07:27:53 -0400 Received: from [192.168.1.2] ([78.54.205.15]) by smtp.web.de (mrweb103 [213.165.67.124]) with ESMTPSA (Nemesis) id 0MI63m-1dv9bO1lks-003xzy; Tue, 26 Sep 2017 13:27:48 +0200 Subject: [PATCH 1/6] [media] tda8261: Use common error handling code in tda8261_set_params() From: SF Markus Elfring To: linux-media@vger.kernel.org, Mauro Carvalho Chehab , Max Kellermann Cc: LKML , kernel-janitors@vger.kernel.org References: <15d74bee-7467-4687-24e1-3501c22f6d75@users.sourceforge.net> Message-ID: <28425caf-2736-96ae-00a7-3fb273b1f9d5@users.sourceforge.net> Date: Tue, 26 Sep 2017 13:27:47 +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: <15d74bee-7467-4687-24e1-3501c22f6d75@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:tIvzIZtMe2dOTAKISdEdaABBnntrx9/ywkc0NiaNOPpVXCCvjii 9ogz6enkgXPhjtKv4m4Eizv1hIGT5a70nNstBKQJoyNSjLb1H9PhUssJzBZiWCjr6YuA1Fg VTnAuW7MB/ESsSZrCpipNc9UfYfw+S4LGxDasnfk2BR50F4V9UtrKxId2oECvkuUPXXITgq fJBLBCm+bFgU7/JEBd2TA== X-UI-Out-Filterresults: notjunk:1; V01:K0:SY0BGtaNpyE=:HkBGPj1xTZoUvXdWYDMtTL 7ER0/3U2bJkMsU8PxzMS/v5gdbYQRuJVihJnHdr9GdJmTJpo9LETg9W4PZftHQ1edmm/p1TMN cEKyhSlmxduC8RQZVSiw0CZ80sJ9eDE+hfgSot6fRjYo0XReMp8/UKbf6VndK7tqnC0LWxzfb W7bS5RdQ1LukEFN38krFt4cHZC/7yWDibLppL9tI8qhUOOvlX4CF2z7yh+A9nygPQo8RNrslk wUQT8qgL0/WyfCeQ2oUcNAOJMSGVJSbPtUmymhT4YI0AFeokiKW4vY5DXIDNrBbIFp7kYBK88 CIn7DBb5sbo+KCBMZZ3fQpOjnqvP+h/Kd203lGtAJ4unMFRS7Fqo+haaZX00ObVNe7Vs3nxMU RtXq4lWh0/WtU5rJxCWbHjDqj9k60n1Wcotk5xzPOywSRIN3AFb6lrL3kni1DY+M0WUGEr/MF WUlysDad4WKzmfrfpN1tquHRaAR/2ZbLO7DOg16seWrYlSv+DG75iaTTlWZJkooTdviPdrg3c A26fYfiWdd2s/Usy9LK5GGnNonnIDsTlwBT3ZJO9GiyrUPd0e4S5GvqNafMz6u0OIpwTPPhKE N/8ojfed/1Uw6I1A0QinhvCzjnIOB11Rmx2UMF9uvjib+Qm97+rJ3MuScc8PsevW6eYwxUl0S Ybq8W8yOg0mFoOirXcB5ajttrDJVl9VOWKMMBFMG1vxHBHm6Qitd1oqE0LWrQtz2+PIyxaCKi 7ZZAtXOMCa5oK6Kx122+kGluYHecmzXsSoqSlC3qqpNaKk5pmUGsDt/pWRWYpSbqzPUm3G5/7 L5KjFwPTy06E+2hsDWaytowBrcb1nfxn4TE9pHtzpBmS4ciP7c= 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: Tue, 26 Sep 2017 11:01:44 +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. * The script "checkpatch.pl" pointed information out like the following. ERROR: do not use assignment in if condition Thus fix an affected source code place. Signed-off-by: Markus Elfring --- drivers/media/dvb-frontends/tda8261.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/media/dvb-frontends/tda8261.c b/drivers/media/dvb-frontends/tda8261.c index 4eb294f330bc..5a8a9b6b8107 100644 --- a/drivers/media/dvb-frontends/tda8261.c +++ b/drivers/media/dvb-frontends/tda8261.c @@ -129,18 +129,18 @@ static int tda8261_set_params(struct dvb_frontend *fe) /* Set params */ err = tda8261_write(state, buf); - if (err < 0) { - pr_err("%s: I/O Error\n", __func__); - return err; - } + err = tda8261_get_status(fe, &status); + if (err < 0) + goto report_failure; + /* sleep for some time */ pr_debug("%s: Waiting to Phase LOCK\n", __func__); msleep(20); /* check status */ - if ((err = tda8261_get_status(fe, &status)) < 0) { - pr_err("%s: I/O Error\n", __func__); - return err; - } + err = tda8261_get_status(fe, &status); + if (err < 0) + goto report_failure; + if (status == 1) { pr_debug("%s: Tuner Phase locked: status=%d\n", __func__, status); @@ -150,6 +150,10 @@ static int tda8261_set_params(struct dvb_frontend *fe) } return 0; + +report_failure: + pr_err("%s: I/O Error\n", __func__); + return err; } static void tda8261_release(struct dvb_frontend *fe)