[PATCH] staging: comedi: fix coding style issue.

Ian Abbott abbotti at mev.co.uk
Tue Aug 4 14:14:55 UTC 2015


On 04/08/15 14:21, Ted Chen wrote:
> fixed coding style issue
>    - replaced ENOSYS by ENODEV.

The patch needs a better description, and ENODEV is not necessarily the 
best thing to return in all cases.

The patch should be split into separate patches, but one of those 
patches wouldn't apply anyway.

>
> Signed-off-by: Ted Chen <tedc.37zngo at gmail.com>
> ---
>   drivers/staging/comedi/comedi_fops.c |    2 +-
>   drivers/staging/comedi/drivers.c     |    2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
> index 146ab00..6896a1f 100644
> --- a/drivers/staging/comedi/comedi_fops.c
> +++ b/drivers/staging/comedi/comedi_fops.c
> @@ -2611,7 +2611,7 @@ static int comedi_open(struct inode *inode, struct file *file)
>   	}
>   	if (dev->attached && dev->use_count == 0) {
>   		if (!try_module_get(dev->driver->module)) {
> -			rc = -ENOSYS;
> +			rc = -ENODEV;
>   			goto out;
>   		}
>   		if (dev->open) {

This no longer applies to linux-next as it currently uses -ENXIO here.

> diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
> index ed0b60c..0b7000a 100644
> --- a/drivers/staging/comedi/drivers.c
> +++ b/drivers/staging/comedi/drivers.c
> @@ -820,7 +820,7 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>   			 "driver '%s' does not support attach using comedi_config\n",
>   			 driv->driver_name);
>   		module_put(driv->module);
> -		ret = -ENOSYS;
> +		ret = -ENODEV;

ENODEV isn't really appropriate here.  I suggest using either -EIO (as 
used earlier in the same function) or -ENOTSUP.

>   		goto out;
>   	}
>   	dev->driver = driv;
>

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk> )=-
-=(                          Web: http://www.mev.co.uk/  )=-


More information about the devel mailing list