diff options
author | Alan Cox <alan@linux.intel.com> | 2009-08-14 15:49:22 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:02:15 -0700 |
commit | a4e80a1bcc5df3a48cb8a51dd357045c4ebbebc0 (patch) | |
tree | 224217da6b1432de9307acb6c7f01b3952a2c391 /drivers/staging | |
parent | cfd498be6e1b89735259690755ad7b9b9bc2a154 (diff) |
Staging: sep: untangle the register_fs code
While goto can be useful for cleaner cleaning up in C (as Linux sometimes
does and I think Linus borrowed stylistically from Amiga) you can overdo it.
Here is a fine fine example of when it's overkill
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/sep/sep_driver.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index 79dce5804c6..aa864362ad3 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -2169,8 +2169,8 @@ static int sep_get_time_handler(struct sep_device *sep, unsigned long arg) struct sep_driver_get_time_t command_args; mutex_lock(&sep_mutex); - command_arg.time_value = sep_set_time(sep); - command_args.time_physical_address = sep_time_address(sep); + command_args.time_value = sep_set_time(sep); + command_args.time_physical_address = (unsigned long)sep_time_address(sep); mutex_unlock(&sep_mutex); if (copy_to_user((void __user *)arg, &command_args, sizeof(struct sep_driver_get_time_t))) @@ -2646,31 +2646,22 @@ static int sep_register_driver_to_fs(void) { int ret_val = alloc_chrdev_region(&sep_devno, 0, 1, "sep_sec_driver"); if (ret_val) { - edbg("sep_driver:major number allocation failed, retval is %d\n", ret_val); - goto end_function; + edbg("sep: major number allocation failed, retval is %d\n", + ret_val); + return ret_val; } - /* init cdev */ cdev_init(&sep_cdev, &sep_file_operations); sep_cdev.owner = THIS_MODULE; /* register the driver with the kernel */ ret_val = cdev_add(&sep_cdev, sep_devno, 1); - if (ret_val) { edbg("sep_driver:cdev_add failed, retval is %d\n", ret_val); - goto end_function_unregister_devnum; + /* unregister dev numbers */ + unregister_chrdev_region(sep_devno, 1); } - - goto end_function; - -end_function_unregister_devnum: - - /* unregister dev numbers */ - unregister_chrdev_region(sep_devno, 1); - -end_function: - return ret_val; + return ret_val; } |