From: Sudip Mukherjee Date: Fri, 27 Mar 2015 09:56:09 +0000 (+0530) Subject: staging: unisys: unregister chardev on error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6bdb610142fc0433077e24bb36f90e7c52bcaded;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: unisys: unregister chardev on error after registering the major numbers if the cdev_add fails then we were not releasing the major numbers. now we are doing that. Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 39b19afa5169..5c5d35f10471 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -65,8 +65,10 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel) return -1; } rc = cdev_add(&file_cdev, MKDEV(MAJOR(major_dev), 0), 1); - if (rc < 0) + if (rc < 0) { + unregister_chrdev_region(major_dev, 1); return -1; + } return 0; }