From: Sudip Mukherjee Date: Tue, 24 Mar 2015 15:17:28 +0000 (+0530) Subject: staging: unisys: use local variable in cleanup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=addceb12a3ed62e50c842f4c8f6099e1ead29ba8;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git staging: unisys: use local variable in cleanup 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 Reviewed-by: Dan Carpenter Signed-off-by: Benjamin Romer Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/unisys/visorchipset/file.c b/drivers/staging/unisys/visorchipset/file.c index 6ebe7f733ba4..257cfdd841d4 100644 --- a/drivers/staging/unisys/visorchipset/file.c +++ b/drivers/staging/unisys/visorchipset/file.c @@ -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); } } diff --git a/drivers/staging/unisys/visorchipset/file.h b/drivers/staging/unisys/visorchipset/file.h index dc7a19556b3f..51f7699b744b 100644 --- a/drivers/staging/unisys/visorchipset/file.h +++ b/drivers/staging/unisys/visorchipset/file.h @@ -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 diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 9c8605dea475..f2663d2c7530 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -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); }