From patchwork Mon Dec 28 19:20:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 7927021 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 95FBC9F350 for ; Mon, 28 Dec 2015 19:21:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94253201F2 for ; Mon, 28 Dec 2015 19:21:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id ADCF0201CD for ; Mon, 28 Dec 2015 19:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbbL1TUj (ORCPT ); Mon, 28 Dec 2015 14:20:39 -0500 Received: from mout.web.de ([212.227.17.11]:54100 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbbL1TUg (ORCPT ); Mon, 28 Dec 2015 14:20:36 -0500 Received: from [192.168.1.2] ([78.48.234.128]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0Ls95v-1a8Moz3ORT-013xSg; Mon, 28 Dec 2015 20:20:30 +0100 Subject: [PATCH] [media] xc5000: Faster result reporting in xc_load_fw_and_init_tuner() References: <566ABCD9.1060404@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall To: linux-media@vger.kernel.org, Mauro Carvalho Chehab From: SF Markus Elfring X-Enigmail-Draft-Status: N1110 Message-ID: <56818B7B.8040801@users.sourceforge.net> Date: Mon, 28 Dec 2015 20:20:27 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <566ABCD9.1060404@users.sourceforge.net> X-Provags-ID: V03:K0:8tpHYqco485ZannOMrcaBvS0r6pEB0krTvy/h1Bmm5lBNZF6I9H D56KEJdc9jxnM/c3SxVZ8BasXVajLT+o7/0pvvnXbiJ4c41uNYbr4vKknj6aB2T5kPlGP31 3IU55vYj+yaAi+0GWVpuoa4DhKr9xdc82CaQaupg2GyPRvfeeloflt/oHx3gQTuy70vXZWs YXuyY6NqsI8ysecOkWw6g== X-UI-Out-Filterresults: notjunk:1; V01:K0:jUmh/w11ET4=:S6tmumVnJ0BoEGXa0VOTs6 9aycAn1YFGqdo+YtIfWLyzYHANMt60XMHVjx9e2fkQosj29dpKuVM1L504wFZ6eb5fROLviTn uWZJ6JjacQgEubSticI00TjpKAAoGoff96YnXPB4fHyEDuFDfG62GufVG3PKNRs06qNO2/eIo eGdZXf2eILvWeUAu9B2p/X/TMB2vJT7VK8X+4YZf7hUOgxj9mam5KYLEGNQCPNZsMMQv8boDe /8KwrWiEepV9WvVCblAFpYt1nWAzl843zKCYa8wKefovfmKx6vaF6VsoKDpdbpTiG7SG+zH5v K2110S8DqgRAVvbqxsooMHaChWfiJYG5ZRROjq1ug08LA5sa8HTgoq1rkjL3QHXqlUvsBJF1j 9v+EtBlwD1eSegWnaJ+p6cSWqGGjmmaXc+kwYIecrQXp5AUUqmPuGs7dHMilbezs0Jk7Hiile UJkUutfkvYLMFhlHKigkmiKUOvUAmMeTeGVMxxcMB5yW96COV+TsQdLG08vc7OPiTAsR6dDUc 6yWPfGzuHDVIJaGLs85w2KmluMFoUGQmqlfFAuRQyVdoWHHWx412UsXvnLQztitrqZPGEkRc7 IxGdmh0j4YIOUZc1pnPyhHGIquGnHmrUyWQ2htO/uMXK1DvjEOtKmotiycBoOX/vmgtTNIMAz 2CM9uQQcHKtPE6xKjQveSTaFGmBX3QdOztDKxfv9H1hwyAnqC8MIDG47u4lbG0SxZWgogP2lQ UHFEaWMVhs06Ee2WmLHirkjNMhV2p951pHfLBUNdyw7LJfh0SgHKAn3t7xS/0SMo7F9oaFDW5 crnjKmpx3w8XXBUcVYEezKusaPgCA== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Markus Elfring Date: Mon, 28 Dec 2015 20:10:30 +0100 This issue was detected by using the Coccinelle software. Split the previous if statement at the end so that each final log statement will eventually be performed by a direct jump to these labels. * report_failure * report_success A check repetition can be excluded for the variable "ret" at the end then. Apply also two recommendations from the script "checkpatch.pl". Signed-off-by: Markus Elfring --- drivers/media/tuners/xc5000.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/media/tuners/xc5000.c b/drivers/media/tuners/xc5000.c index e6e5e90..1360677 100644 --- a/drivers/media/tuners/xc5000.c +++ b/drivers/media/tuners/xc5000.c @@ -1166,7 +1166,7 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) ret = xc5000_fwupload(fe, desired_fw, fw); if (ret != 0) - goto err; + goto report_failure; msleep(20); @@ -1229,18 +1229,16 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe, int force) /* Default to "CABLE" mode */ ret = xc_write_reg(priv, XREG_SIGNALSOURCE, XC_RF_MODE_CABLE); if (!ret) - break; + goto report_success; printk(KERN_ERR "xc5000: can't set to cable mode."); } -err: - if (!ret) - printk(KERN_INFO "xc5000: Firmware %s loaded and running.\n", - desired_fw->name); - else - printk(KERN_CONT " - too many retries. Giving up\n"); - +report_failure: + pr_cont(" - too many retries. Giving up\n"); return ret; +report_success: + pr_info("xc5000: Firmware %s loaded and running.\n", desired_fw->name); + return 0; } static void xc5000_do_timer_sleep(struct work_struct *timer_sleep)