Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l2-core: return -ENODEV from ioctl when not registered

I spotted a minor difference is handling of unregistered devices
between native and compat ioctls: the native handler never tries
to call into the driver if a device is not marked as registered.

I did not check whether this can cause issues in the kernel, or
just a different between return codes, but it clearly makes
sense that both should behave the same way.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Arnd Bergmann and committed by
Mauro Carvalho Chehab
8162f78d 765ba251

+3
+3
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
··· 1244 1244 if (!file->f_op->unlocked_ioctl) 1245 1245 return ret; 1246 1246 1247 + if (!video_is_registered(vdev)) 1248 + return -ENODEV; 1249 + 1247 1250 if (_IOC_TYPE(cmd) == 'V' && _IOC_NR(cmd) < BASE_VIDIOC_PRIVATE) 1248 1251 ret = file->f_op->unlocked_ioctl(file, cmd, 1249 1252 (unsigned long)compat_ptr(arg));