From 324e87b7e135c01725a9cef02cb8436f65e65f07 Mon Sep 17 00:00:00 2001 From: Christian Gromm Date: Fri, 19 Aug 2016 13:09:34 +0200 Subject: [PATCH] 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 --- drivers/staging/most/aim-cdev/cdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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"); -- 2.11.0