From: Alan Cox Date: Fri, 14 Aug 2009 14:49:22 +0000 (+0100) Subject: Staging: sep: untangle the register_fs code X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=a4e80a1bcc5df3a48cb8a51dd357045c4ebbebc0;p=openwrt%2Fstaging%2Fblogic.git 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 Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index 79dce5804c63..aa864362ad34 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; }