Skip to contentSkip to conversation

r820t: Remove a warning for an unused value

PATCH New Mauro Carvalho Chehab 1 participant 4 messages Apr 25, 2013 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 r820t: Remove a warning for an unused value

Currently, the driver complains about the pre_detect var:

	drivers/media/tuners/r820t.c: In function 'r820t_sysfreq_sel':
	drivers/media/tuners/r820t.c:722:31: warning: variable 'pre_dect' set but not used [-Wunused-but-set-variable]

While rtl8232 code comments it, perhaps some other driver may use. So, the better is to keep the code there, allowing to enable it via r820t config data.

---
 drivers/media/tuners/r820t.c | 7 +++++++
 drivers/media/tuners/r820t.h | 1 +
 2 files changed, 8 insertions(+)
drivers/media/tuners/r820t.c +7 -0
index e6e7a06..4835021 100644
@@ -797,6 +797,13 @@ static int r820t_sysfreq_sel(struct r820t_priv *priv, u32 freq,
 		cable2_in = 0x00;
 	}
 
+
+	if (priv->cfg->use_predetect) {
+		rc = r820t_write_reg_mask(priv, 0x06, pre_dect, 0x40);
+		if (rc < 0)
+			return rc;
+	}
+
 	rc = r820t_write_reg_mask(priv, 0x1d, lna_top, 0xc7);
 	if (rc < 0)
 		return rc;
drivers/media/tuners/r820t.h +1 -0
index 4c0823b..48af354 100644
@@ -39,6 +39,7 @@ struct r820t_config {
 	enum r820t_chip rafael_chip;
 	unsigned max_i2c_msg_len;
 	bool use_diplexer;
+	bool use_predetect;
 };
 
 #if IS_ENABLED(CONFIG_MEDIA_TUNER_R820T)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 2/4 cx25821-video: remove maxw from cx25821_vidioc_try_fmt_vid_cap

After cx25821-video cleanup, this var is not used anymore:

drivers/media/pci/cx25821/cx25821-video.c: In function 'cx25821_vidioc_try_fmt_vid_cap':
drivers/media/pci/cx25821/cx25821-video.c:591:15: warning: variable 'maxw' set but not used [-Wunused-but-set-variable]

as the code now checks the max width as the default case for the range check.

---
 drivers/media/pci/cx25821/cx25821-video.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/pci/cx25821/cx25821-video.c +1 -2
index b194138..3ba856a 100644
@@ -588,13 +588,12 @@ static int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 	struct cx25821_dev *dev = chan->dev;
 	const struct cx25821_fmt *fmt;
 	enum v4l2_field field = f->fmt.pix.field;
-	unsigned int maxw, maxh;
+	unsigned int maxh;
 	unsigned w;
 
 	fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat);
 	if (NULL == fmt)
 		return -EINVAL;
-	maxw = 720;
 	maxh = (dev->tvnorm & V4L2_STD_625_50) ? 576 : 480;
 
 	w = f->fmt.pix.width;
Signature · 1 line
1.8.1.4
#2 lore raw

PATCH 3/4 cx25821-video: declare cx25821_vidioc_s_std as static

In reply to Mauro Carvalho Chehab

Fixes the following warning:

	drivers/media/pci/cx25821/cx25821-video.c: At top level:
	drivers/media/pci/cx25821/cx25821-video.c:766:5: warning: no previous prototype for 'cx25821_vidioc_s_std' [-Wmissing-prototypes]
---
 drivers/media/pci/cx25821/cx25821-video.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/pci/cx25821/cx25821-video.c +2 -1
index 3ba856a..d270819 100644
@@ -762,7 +762,8 @@ static int cx25821_vidioc_g_std(struct file *file, void *priv, v4l2_std_id *tvno
 	return 0;
 }
 
-int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id tvnorms)
+static int cx25821_vidioc_s_std(struct file *file, void *priv,
+				v4l2_std_id tvnorms)
 {
 	struct cx25821_channel *chan = video_drvdata(file);
 	struct cx25821_dev *dev = chan->dev;
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 4/4 cx25821-alsa; get rid of a __must_check error

In reply to Mauro Carvalho Chehab

The hole reason for __must_check is to not ignore an error.

However, a "ret" value is used at cx25821 just to avoid the Kernel compilation to compain about it.

That, however, produces another warning (with W=1):

drivers/media/pci/cx25821/cx25821-alsa.c: In function 'cx25821_audio_fini':
drivers/media/pci/cx25821/cx25821-alsa.c:727:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]

With the current implementation of driver_for_each_device() and cx25821_alsa_exit_callback(), there's actually just one very unlikely condition where it will currently produce an error: if driver_find() returns NULL.

Ok, there's not much that can be done, as it is on a driver's function that returns void, but it can at least print some message if the error happens.

---
 drivers/media/pci/cx25821/cx25821-alsa.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/pci/cx25821/cx25821-alsa.c +2 -0
index 81361c2..6e91e84 100644
@@ -727,6 +727,8 @@ static void cx25821_audio_fini(void)
 	int ret;
 
 	ret = driver_for_each_device(drv, NULL, NULL, cx25821_alsa_exit_callback);
+	if (ret)
+		pr_err("%s failed to find a cx25821 driver.\n", __func__);
 }
 
 static int cx25821_alsa_init_callback(struct device *dev, void *data)
Signature · 1 line
1.8.1.4