From patchwork Mon Dec 28 16:32:22 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: 7926761 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 2E4829F387 for ; Mon, 28 Dec 2015 16:32:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5495920251 for ; Mon, 28 Dec 2015 16:32:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 715372024C for ; Mon, 28 Dec 2015 16:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752432AbbL1Qcl (ORCPT ); Mon, 28 Dec 2015 11:32:41 -0500 Received: from mout.web.de ([212.227.17.12]:65423 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751474AbbL1Qcj (ORCPT ); Mon, 28 Dec 2015 11:32:39 -0500 Received: from [192.168.1.2] ([78.48.234.128]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0Lg01f-1ZuCTJ1ER1-00pZe9; Mon, 28 Dec 2015 17:32:34 +0100 Subject: [PATCH 2/2] [media] r820t: Better exception handling in generic_set_freq() To: linux-media@vger.kernel.org, Mauro Carvalho Chehab References: <566ABCD9.1060404@users.sourceforge.net> <56816256.70304@users.sourceforge.net> Cc: LKML , kernel-janitors@vger.kernel.org, Julia Lawall From: SF Markus Elfring Message-ID: <56816416.2060702@users.sourceforge.net> Date: Mon, 28 Dec 2015 17:32:22 +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: <56816256.70304@users.sourceforge.net> X-Provags-ID: V03:K0:qDXUyKKt7XzSsfBTcpqenkz1TGrNx15gVN8n2pC0H4emQFi0ULB 8yZoJAEMwqWGbLQyaqsKnRzwWGY8+c+R2nfDKuh8xcggo6IEioLIzhjYaAQj1UQ9W59VgC+ vzQN+9mGw9+c83H8bRKDIOHemfNcYpv4AoW8Gps6oKAuB7r9J9m6v9FZXYNKj+wNd/axxTR zXgk/k6P4xWogsqkAUsHw== X-UI-Out-Filterresults: notjunk:1; V01:K0:tgvQyjzdJEo=:wvV4qPiEvE3G7NQK6x8G7t yhnKAAbAK7wk4g81ruVZPH7k3DB8OomxM+PB3W8f80H03gxRquIBdnTu0oTBgoKb9mczRzAF/ B5DgmleVmeV+ynSxb/9H/Lw/4DOEJpoj6J00EwId++aBXasJtn+jt1pzh4PBgqkrgVNK0WZr6 u0V6f1F/tFIdXmnZq5tmm039a3lO0H3mFMlys6tAeTJ9dgXL93cn5onCMliJawG6SIqrx4+hY 98kUgCgY1dEsVcHpAmMNQ7vSP4NmVukTR0RhafDnthyRerTFBCKtIpsgWJZkc9plcsfsHg0s+ scbh6nt0frMI03UUUKjmCbt3JLZAMHlqbOnFL8ckXY/9AL6NDkexzk7uCIh4n+pCQsYNmxcLj 0cOOms2HEkKhIzJehvdPLmumyXhC+0RtEea0I4JwcOhln9vx4fUY5xMo5KmgaztJckYLu1OFu 3LVFHasotyNmuS3LFCbGAkJsGcww8Gw6glv226ZoNn+8KELWZ/N7siMuUJ3cP4oy68H9MKWYa KzPS+DNvmo6QCKkD1PI/xvoqYJ7alTmkS4SW+Zd1Y+XSXE1buYSbx3Ob+cfeuHUwRlkO6Yno+ CKJjhNqAk5Eu+9QmoduCAnLLUrornxv+i8+TyPljJBu74RCjIhy2iIX6I7ggnRx8c/V8EsObf Nm3GwYo+flZfuOIJX428J4bekyc689WlXEUhwBULGSRWDMf5nf+H+AA5k3m4FXotj5SpC13sV QSsNNi4lSEJH31yTzyY5tqiFMkIFXRqdMhfQo4tg0sUgatMzleEvbxkJY4qa2xTvoSEHCSQy9 1UefjWjEmMySFIZrNkwjYchJiXmyw== 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 17:13:02 +0100 This issue was detected by using the Coccinelle software. Move the jump label directly before the desired log statement so that the variable "rc" will not be checked once more after a function call. Use the identifier "report_failure" instead of "err". The error logging is performed in a separate section at the end now. Signed-off-by: Markus Elfring --- drivers/media/tuners/r820t.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c index 6ab35e3..f71642e 100644 --- a/drivers/media/tuners/r820t.c +++ b/drivers/media/tuners/r820t.c @@ -1303,7 +1303,7 @@ static int generic_set_freq(struct dvb_frontend *fe, rc = r820t_set_tv_standard(priv, bw, type, std, delsys); if (rc < 0) - goto err; + goto report_failure; if ((type == V4L2_TUNER_ANALOG_TV) && (std == V4L2_STD_SECAM_LC)) lo_freq = freq - priv->int_freq; @@ -1312,23 +1312,21 @@ static int generic_set_freq(struct dvb_frontend *fe, rc = r820t_set_mux(priv, lo_freq); if (rc < 0) - goto err; + goto report_failure; rc = r820t_set_pll(priv, type, lo_freq); if (rc < 0 || !priv->has_lock) - goto err; + goto report_failure; rc = r820t_sysfreq_sel(priv, freq, type, std, delsys); if (rc < 0) - goto err; + goto report_failure; tuner_dbg("%s: PLL locked on frequency %d Hz, gain=%d\n", __func__, freq, r820t_read_gain(priv)); - -err: - - if (rc < 0) - tuner_dbg("%s: failed=%d\n", __func__, rc); + return 0; +report_failure: + tuner_dbg("%s: failed=%d\n", __func__, rc); return rc; }