Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030447AbdIZL1z (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 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-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit 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-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1761 Lines: 63 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) -- 2.14.1