diff options
author | Alexandru Ardelean <alexandru.ardelean@analog.com> | 2020-11-17 12:51:54 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2020-11-21 19:48:23 +0300 |
commit | 74d826da3842ce893e943f9f23ddb7f07fc8d7fe (patch) | |
tree | c1c89697fa9f5d0becd9bc9883efa61ff97fd66e /drivers/iio | |
parent | ee8caea0c1449271d6f03145d367423dc5d8749c (diff) | |
download | linux-74d826da3842ce893e943f9f23ddb7f07fc8d7fe.tar.xz |
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>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/industrialio-core.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index 89f9af12c8e6..7cae46f9bc0d 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1743,6 +1743,9 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) break; } + if (ret == IIO_IOCTL_UNHANDLED) + ret = -EINVAL; + out_unlock: mutex_unlock(&indio_dev->info_exist_lock); |