staging: unisys: unregister chardev on error
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 27 Mar 2015 09:56:09 +0000 (15:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 3 Apr 2015 11:43:44 +0000 (13:43 +0200)
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 <sudip@vectorindia.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorchipset/file.c

index 39b19afa51692e36a99557a3657b9578a3a016ad..5c5d35f104713d6c5d5656fb5c01dad87a057fef 100644 (file)
@@ -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;
 }