diff mbox series

[16/21] lustre: obdclass: normalize a switch statement.

Message ID 154949781331.10620.12767117536447190491.stgit@noble.brown (mailing list archive)
State New, archived
Headers show
Series lustre: Assorted cleanups for obdclass | expand

Commit Message

NeilBrown Feb. 7, 2019, 12:03 a.m. UTC
Remove the unnecessary {}, and use "break" rather than
"goto out;" for normal exit from the cases.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 drivers/staging/lustre/lustre/obdclass/class_obd.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Andreas Dilger Feb. 8, 2019, 5:57 a.m. UTC | #1
On Feb 6, 2019, at 17:03, NeilBrown <neilb@suse.com> wrote:
> 
> Remove the unnecessary {}, and use "break" rather than
> "goto out;" for normal exit from the cases.
> 
> Signed-off-by: NeilBrown <neilb@suse.com>

Reviewed-by: Andreas Dilger <adilger@whamcloud.com>

Cheers, Andreas
---
Andreas Dilger
Principal Lustre Architect
Whamcloud
James Simmons Feb. 11, 2019, 4:03 a.m. UTC | #2
> Remove the unnecessary {}, and use "break" rather than
> "goto out;" for normal exit from the cases.

Reviewed-by: James Simmons <jsimmons@infradead.org>
 
> Signed-off-by: NeilBrown <neilb@suse.com>
> ---
>  drivers/staging/lustre/lustre/obdclass/class_obd.c |   10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
> index 2ef4fd41cdd0..48d1dabafa65 100644
> --- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
> +++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
> @@ -518,7 +518,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
>  	}
>  
>  	switch (cmd) {
> -	case OBD_IOC_NO_TRANSNO: {
> +	case OBD_IOC_NO_TRANSNO:
>  		if (!obd->obd_attached) {
>  			CERROR("Device %d not attached\n", obd->obd_minor);
>  			err = -ENODEV;
> @@ -528,18 +528,16 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg)
>  		       obd->obd_name);
>  		obd->obd_no_transno = 1;
>  		err = 0;
> -		goto out;
> -	}
> +		break;
>  
> -	default: {
> +	default:
>  		err = obd_iocontrol(cmd, obd->obd_self_export, len, data, NULL);
>  		if (err)
>  			goto out;
>  
>  		if (copy_to_user((void __user *)arg, data, len))
>  			err = -EFAULT;
> -		goto out;
> -	}
> +		break;
>  	}
>  
>   out:
> 
> 
>
diff mbox series

Patch

diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 2ef4fd41cdd0..48d1dabafa65 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -518,7 +518,7 @@  int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 	}
 
 	switch (cmd) {
-	case OBD_IOC_NO_TRANSNO: {
+	case OBD_IOC_NO_TRANSNO:
 		if (!obd->obd_attached) {
 			CERROR("Device %d not attached\n", obd->obd_minor);
 			err = -ENODEV;
@@ -528,18 +528,16 @@  int class_handle_ioctl(unsigned int cmd, unsigned long arg)
 		       obd->obd_name);
 		obd->obd_no_transno = 1;
 		err = 0;
-		goto out;
-	}
+		break;
 
-	default: {
+	default:
 		err = obd_iocontrol(cmd, obd->obd_self_export, len, data, NULL);
 		if (err)
 			goto out;
 
 		if (copy_to_user((void __user *)arg, data, len))
 			err = -EFAULT;
-		goto out;
-	}
+		break;
 	}
 
  out: