Skip to content

Commit af0670b

Browse files
commodojic23
authored andcommitted
iio: core: return ENODEV if ioctl is unknown
When the ioctl() mechanism was introduced in IIO core to centralize the registration of all ioctls in one place via commit 8dedcc3 ("iio: core: centralize ioctl() calls to the main chardev"), the return code was changed from ENODEV to EINVAL, when the ioctl code isn't known. This was done by accident. This change reverts back to the old behavior, where if the ioctl() code isn't known, ENODEV is returned (vs EINVAL). This was brought into perspective by this patch: https://lore.kernel.org/linux-iio/[email protected]/ Fixes: 8dedcc3 ("iio: core: centralize ioctl() calls to the main chardev") Signed-off-by: Alexandru Ardelean <[email protected]> Reviewed-by: Nuno Sá <[email protected]> Tested-by: Paul Cercueil <[email protected]> Reviewed-by: Linus Walleij <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 901f84d commit af0670b

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/iio/industrialio-core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,15 +1778,14 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
17781778
if (!indio_dev->info)
17791779
goto out_unlock;
17801780

1781-
ret = -EINVAL;
17821781
list_for_each_entry(h, &iio_dev_opaque->ioctl_handlers, entry) {
17831782
ret = h->ioctl(indio_dev, filp, cmd, arg);
17841783
if (ret != IIO_IOCTL_UNHANDLED)
17851784
break;
17861785
}
17871786

17881787
if (ret == IIO_IOCTL_UNHANDLED)
1789-
ret = -EINVAL;
1788+
ret = -ENODEV;
17901789

17911790
out_unlock:
17921791
mutex_unlock(&indio_dev->info_exist_lock);

0 commit comments

Comments
 (0)