From: Christian Gromm Date: Fri, 19 Aug 2016 11:09:34 +0000 (+0200) Subject: staging: most: aim-cdev: report error returned by alloc_chrdev_region X-Git-Tag: v4.9-rc1~119^2~1036 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=324e87b7e135c01725a9cef02cb8436f65e65f07;p=karo-tx-linux.git staging: most: aim-cdev: report error returned by alloc_chrdev_region 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/most/aim-cdev/cdev.c b/drivers/staging/most/aim-cdev/cdev.c index 6ca2440b07c4..db6f4586bcaf 100644 --- a/drivers/staging/most/aim-cdev/cdev.c +++ b/drivers/staging/most/aim-cdev/cdev.c @@ -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");