Commit 74d826da authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron

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: 8dedcc3e ("iio: core: centralize ioctl() calls to the main chardev")
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Link: https://lore.kernel.org/r/20201117095154.7189-1-alexandru.ardelean@analog.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent ee8caea0
...@@ -1743,6 +1743,9 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1743,6 +1743,9 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
break; break;
} }
if (ret == IIO_IOCTL_UNHANDLED)
ret = -EINVAL;
out_unlock: out_unlock:
mutex_unlock(&indio_dev->info_exist_lock); mutex_unlock(&indio_dev->info_exist_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment