V4L/DVB (13547): radio: add trivial checks on the tuner and type args.
[platform/kernel/linux-starfive.git] / drivers / media / radio / radio-zoltrix.c
index 80e98b6..f31eab9 100644 (file)
@@ -266,6 +266,8 @@ static int vidioc_s_frequency(struct file *file, void *priv,
 {
        struct zoltrix *zol = video_drvdata(file);
 
+       if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO)
+               return -EINVAL;
        if (zol_setfreq(zol, f->frequency) != 0)
                return -EINVAL;
        return 0;
@@ -276,6 +278,8 @@ static int vidioc_g_frequency(struct file *file, void *priv,
 {
        struct zoltrix *zol = video_drvdata(file);
 
+       if (f->tuner != 0)
+               return -EINVAL;
        f->type = V4L2_TUNER_RADIO;
        f->frequency = zol->curfreq;
        return 0;