@@ -397,6 +397,11 @@ int video_register_device_index(struct v
if (!vdev->release)
return -EINVAL;
+ /* if no video standards are supported then no need to get and set
+ them: they will never be called */
+ WARN_ON(!vdev->tvnorms && vdev->ioctl_ops->vidioc_g_std);
+ WARN_ON(!vdev->tvnorms && vdev->ioctl_ops->vidioc_s_std);
+
/* Part 1: check device type */
switch (type) {
case VFL_TYPE_GRABBER:
@@ -1077,12 +1077,15 @@ static long __video_do_ioctl(struct file
{
v4l2_std_id *id = arg;
- ret = 0;
- /* Calls the specific handler */
- if (ops->vidioc_g_std)
- ret = ops->vidioc_g_std(file, fh, id);
- else
- *id = vfd->current_norm;
+ /* Check if any standard is supported */
+ if (vfd->tvnorms) {
+ ret = 0;
+ /* Calls the specific handler */
+ if (ops->vidioc_g_std)
+ ret = ops->vidioc_g_std(file, fh, id);
+ else
+ *id = vfd->current_norm;
+ }
if (!ret)
dbgarg(cmd, "std=0x%08Lx\n", (long long unsigned)*id);
@@ -1095,7 +1098,7 @@ static long __video_do_ioctl(struct file
dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
norm = (*id) & vfd->tvnorms;
- if (vfd->tvnorms && !norm) /* Check if std is supported */
+ if (!norm) /* Check if std is supported */
break;
/* Calls the specific handler */