]> Git Repo - J-linux.git/commitdiff
iio: core: return ENODEV if ioctl is unknown
authorAlexandru Ardelean <[email protected]>
Mon, 3 May 2021 14:43:50 +0000 (17:43 +0300)
committerJonathan Cameron <[email protected]>
Mon, 10 May 2021 13:01:48 +0000 (14:01 +0100)
When the ioctl() mechanism was introduced in IIO core to centralize the
registration of all ioctls in one place via commit 8dedcc3eee3ac ("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/20210428150815[email protected]/

Fixes: 8dedcc3eee3ac ("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]>
drivers/iio/industrialio-core.c

index 9e59f5da3d280448da4d88a9126c575490072647..59efb36db2c7ce485c8ae7186b5665d7b744dfdc 100644 (file)
@@ -1778,7 +1778,6 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        if (!indio_dev->info)
                goto out_unlock;
 
-       ret = -EINVAL;
        list_for_each_entry(h, &iio_dev_opaque->ioctl_handlers, entry) {
                ret = h->ioctl(indio_dev, filp, cmd, arg);
                if (ret != IIO_IOCTL_UNHANDLED)
@@ -1786,7 +1785,7 @@ static long iio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
        }
 
        if (ret == IIO_IOCTL_UNHANDLED)
-               ret = -EINVAL;
+               ret = -ENODEV;
 
 out_unlock:
        mutex_unlock(&indio_dev->info_exist_lock);
This page took 0.055745 seconds and 4 git commands to generate.