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

iio: core: return -EINVAL when no ioctl handler has been run

It seems that when this was tested the happy case was more tested. A few of
the userspace apps rely on this returning negative error codes in case an
ioctl() is not available.

When running multiple ioctl() handlers or when calling an ioctl() that
doesn't exist, IIO_IOCTL_UNHANDLED is returned. In that case -EINVAL should
be returned.

Fixes: 8dedcc3eee3a ("iio: core: centralize ioctl() calls to the main chardev")
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201117095154.7189-1-alexandru.ardelean@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Alexandru Ardelean and committed by
Jonathan Cameron
74d826da ee8caea0

+3
+3
drivers/iio/industrialio-core.c
··· 1743 1743 break; 1744 1744 } 1745 1745 1746 + if (ret == IIO_IOCTL_UNHANDLED) 1747 + ret = -EINVAL; 1748 + 1746 1749 out_unlock: 1747 1750 mutex_unlock(&indio_dev->info_exist_lock); 1748 1751