Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1298704 > unrolled thread

[PATCH 0/2] [media] r820t: Fine-tuning for generic_set_freq()

Started bySF Markus Elfring <elfring@users.sourceforge.net>
First post2015-12-28 17:30 +0100
Last post2015-12-28 17:40 +0100
Articles 3 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 0/2] [media] r820t: Fine-tuning for generic_set_freq() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 17:30 +0100
    [PATCH 1/2] [media] r820t: Delete an unnecessary variable  initialisation in generic_set_freq() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 17:40 +0100
    [PATCH 2/2] [media] r820t: Better exception handling in  generic_set_freq() SF Markus Elfring <elfring@users.sourceforge.net> - 2015-12-28 17:40 +0100

#1298704 — [PATCH 0/2] [media] r820t: Fine-tuning for generic_set_freq()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-12-28 17:30 +0100
Subject[PATCH 0/2] [media] r820t: Fine-tuning for generic_set_freq()
Message-ID<qKIQk-4yb-23@gated-at.bofh.it>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 28 Dec 2015 17:18:34 +0100

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Delete an unnecessary variable initialisation
  Better exception handling

 drivers/media/tuners/r820t.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1298710 — [PATCH 1/2] [media] r820t: Delete an unnecessary variable initialisation in generic_set_freq()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-12-28 17:40 +0100
Subject[PATCH 1/2] [media] r820t: Delete an unnecessary variable initialisation in generic_set_freq()
Message-ID<qKIZX-4Da-11@gated-at.bofh.it>
In reply to#1298704
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 28 Dec 2015 16:36:44 +0100

The variable "rc" will be set to an appropriate value from a call of
the r820t_set_tv_standard() function.
Thus let us omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/media/tuners/r820t.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/tuners/r820t.c b/drivers/media/tuners/r820t.c
index a7a8452..6ab35e3 100644
--- a/drivers/media/tuners/r820t.c
+++ b/drivers/media/tuners/r820t.c
@@ -1295,7 +1295,7 @@ static int generic_set_freq(struct dvb_frontend *fe,
 			    v4l2_std_id std, u32 delsys)
 {
 	struct r820t_priv		*priv = fe->tuner_priv;
-	int				rc = -EINVAL;
+	int				rc;
 	u32				lo_freq;
 
 	tuner_dbg("should set frequency to %d kHz, bw %d MHz\n",
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1298711 — [PATCH 2/2] [media] r820t: Better exception handling in generic_set_freq()

FromSF Markus Elfring <elfring@users.sourceforge.net>
Date2015-12-28 17:40 +0100
Subject[PATCH 2/2] [media] r820t: Better exception handling in generic_set_freq()
Message-ID<qKIZX-4Da-5@gated-at.bofh.it>
In reply to#1298704
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
---
 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;
 }
 
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web