staging: unisys: use local variable in cleanup
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Tue, 24 Mar 2015 15:17:28 +0000 (20:47 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 23:01:23 +0000 (00:01 +0100)
the dev_t was being stored in visorchipset_platform_device.dev.devt
while initializing the module. so pass that value as an argument to
cleanup() so that it can use this local variable instead of the global
variable.

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/unisys/visorchipset/file.c
drivers/staging/unisys/visorchipset/file.h
drivers/staging/unisys/visorchipset/visorchipset_main.c

index 6ebe7f733ba416bd6e7edc52e7fb197102f16b12..257cfdd841d491a6e586a62f64e05826dd682ea0 100644 (file)
@@ -73,13 +73,13 @@ visorchipset_file_init(dev_t major_dev, struct visorchannel **controlvm_channel)
 }
 
 void
-visorchipset_file_cleanup(void)
+visorchipset_file_cleanup(dev_t major_dev)
 {
        if (file_cdev.ops != NULL)
                cdev_del(&file_cdev);
        file_cdev.ops = NULL;
-       if (MAJOR(majordev) >= 0) {
-               unregister_chrdev_region(majordev, 1);
+       if (MAJOR(major_dev) >= 0) {
+               unregister_chrdev_region(major_dev, 1);
                majordev = MKDEV(0, 0);
        }
 }
index dc7a19556b3f127af30079dba3bf66b08d76b602..51f7699b744bd3df40bf72dd0c8f0189d36e9a17 100644 (file)
@@ -22,6 +22,6 @@
 
 int visorchipset_file_init(dev_t majorDev,
                           struct visorchannel **pControlVm_channel);
-void visorchipset_file_cleanup(void);
+void visorchipset_file_cleanup(dev_t major_dev);
 
 #endif
index 9c8605dea475d951a01570ec02b03aabf6060616..f2663d2c753003cdb62171e176baa61b2051cee3 100644 (file)
@@ -2278,7 +2278,7 @@ visorchipset_exit(void)
 
        visorchannel_destroy(controlvm_channel);
 
-       visorchipset_file_cleanup();
+       visorchipset_file_cleanup(visorchipset_platform_device.dev.devt);
        POSTCODE_LINUX_2(DRIVER_EXIT_PC, POSTCODE_SEVERITY_INFO);
 }