staging: Comedi: comedi_fops: Fixed the return error code
authorSanthosh Pai <santhosh.pai88@yahoo.com>
Mon, 29 Jun 2015 09:44:03 +0000 (10:44 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jul 2015 01:22:20 +0000 (18:22 -0700)
This patch fixes the checkpatch.pl warning:

WARNING: ENOSYS means 'invalid syscall nr' and nothing else

try_module_get fails when the reference count of the module is not
allowed to be incremented ,and hence -ENXIO is returned indicating
no device or address.

[IA - combined two of santhosh's changes to the error return value!]

Signed-off-by: santhosh pai <santhosh.pai88@yahoo.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c

index 1679bfba25a95133651bb29d607fe637ebd64919..4820ab6d0aa8694309be452aee05ec425170a13b 100644 (file)
@@ -2606,7 +2606,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 = -ENXIO;
                        goto out;
                }
                if (dev->open) {