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

media: cec: return -ENODEV instead of -ENXIO if unregistered

If the CEC device is unregistered, then an attempt to open
the device node should result in an -ENODEV error instead of
-ENXIO.

Document this as well in cec-func-open.rst.

This is consistent with the error code returned by other
file operations such as ioctl.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

+4 -4
+2 -2
Documentation/userspace-api/media/cec/cec-func-open.rst
··· 70 70 ``ENOMEM`` 71 71 Insufficient kernel memory was available. 72 72 73 - ``ENXIO`` 74 - No device corresponding to this device special file exists. 73 + ``ENODEV`` 74 + Device not found or was removed.
+2 -2
drivers/media/cec/core/cec-core.c
··· 62 62 */ 63 63 mutex_lock(&devnode->lock); 64 64 /* 65 - * return ENXIO if the cec device has been removed 65 + * return ENODEV if the cec device has been removed 66 66 * already or if it is not registered anymore. 67 67 */ 68 68 if (!devnode->registered) { 69 69 mutex_unlock(&devnode->lock); 70 - return -ENXIO; 70 + return -ENODEV; 71 71 } 72 72 /* and increase the device refcount */ 73 73 get_device(&devnode->dev);