aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/radio-sf16fmr2.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-11-27 02:33:25 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-15 21:17:53 -0500
commita3a9e287daa1f299e318161b790b1c5902b1d869 (patch)
tree1f20db447f28a6346ce9d9fe2ebb0ff3eac65f96 /drivers/media/radio/radio-sf16fmr2.c
parentcda4303f555316930a219cd7c03a1925526145f0 (diff)
V4L/DVB (13547): radio: add trivial checks on the tuner and type args.
Many radio drivers did not check the tuner and type field correctly for g/s_frequency. These checks have now been added. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/radio-sf16fmr2.c')
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index a11414f648d4..52c7bbb32b8b 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -251,6 +251,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
251{ 251{
252 struct fmr2 *fmr2 = video_drvdata(file); 252 struct fmr2 *fmr2 = video_drvdata(file);
253 253
254 if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
255 return -EINVAL;
254 if (f->frequency < RSF16_MINFREQ || 256 if (f->frequency < RSF16_MINFREQ ||
255 f->frequency > RSF16_MAXFREQ) 257 f->frequency > RSF16_MAXFREQ)
256 return -EINVAL; 258 return -EINVAL;
@@ -272,6 +274,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
272{ 274{
273 struct fmr2 *fmr2 = video_drvdata(file); 275 struct fmr2 *fmr2 = video_drvdata(file);
274 276
277 if (f->tuner != 0)
278 return -EINVAL;
275 f->type = V4L2_TUNER_RADIO; 279 f->type = V4L2_TUNER_RADIO;
276 f->frequency = fmr2->curfreq; 280 f->frequency = fmr2->curfreq;
277 return 0; 281 return 0;