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>
This commit is contained in:
Hans Verkuil
2009-11-27 04:33:25 -03:00
committed by Mauro Carvalho Chehab
parent cda4303f55
commit a3a9e287da
14 changed files with 55 additions and 1 deletions

View File

@@ -168,6 +168,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
{
struct fmi *fmi = video_drvdata(file);
if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
return -EINVAL;
if (f->frequency < RSF16_MINFREQ ||
f->frequency > RSF16_MAXFREQ)
return -EINVAL;
@@ -182,6 +184,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
{
struct fmi *fmi = video_drvdata(file);
if (f->tuner != 0)
return -EINVAL;
f->type = V4L2_TUNER_RADIO;
f->frequency = fmi->curfreq;
return 0;