staging: most: aim-cdev: report error returned by alloc_chrdev_region
authorChristian Gromm <christian.gromm@microchip.com>
Fri, 19 Aug 2016 11:09:34 +0000 (13:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 14:50:38 +0000 (16:50 +0200)
This patch forwards the error code returned by function
alloc_chrdev_region(). It is needed to stop the module
from hiding the actual cause of failure.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/most/aim-cdev/cdev.c

index 6ca2440..db6f458 100644 (file)
@@ -507,8 +507,9 @@ static int __init mod_init(void)
        spin_lock_init(&ch_list_lock);
        ida_init(&minor_id);
 
-       if (alloc_chrdev_region(&aim_devno, 0, 50, "cdev") < 0)
-               return -ENOMEM;
+       err = alloc_chrdev_region(&aim_devno, 0, 50, "cdev");
+       if (err < 0)
+               return err;
        major = MAJOR(aim_devno);
 
        aim_class = class_create(THIS_MODULE, "most_cdev_aim");