Skip to contentSkip to conversation

- remove ugly code from usb/serial/usb-serial.c.

PATCH Applied Luiz Fernando N. Capitulino 2 participants 2 messages Sep 13, 2004 – Sep 14, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 - remove ugly code from usb/serial/usb-serial.c.

Greg,

This patch removes ugly code from some function in usb/serial/usb-serial.c
which is using a goto statement intead of a simple `return'.

To be true, I'm not certain if there is a special reason to do that, if so
ignore me. ;)

 drivers/usb/serial/usb-serial.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
drivers/usb/serial/usb-serial.c +4 -16
diff -X /home/capitulino/kernels/2.6/dontdiff -Nparu a/drivers/usb/serial/usb-serial.c a~/drivers/usb/serial/usb-serial.c
@@ -621,15 +621,12 @@ static void serial_throttle (struct tty_
 
 	if (!port->open_count) {
 		dbg ("%s - port not open", __FUNCTION__);
-		goto exit;
+		return;
 	}
 
 	/* pass on to the driver specific version of this function */
 	if (port->serial->type->throttle)
 		port->serial->type->throttle(port);
-
-exit:
-	;
 }
 
 static void serial_unthrottle (struct tty_struct * tty)
@@ -640,15 +637,12 @@ static void serial_unthrottle (struct tt
 
 	if (!port->open_count) {
 		dbg("%s - port not open", __FUNCTION__);
-		goto exit;
+		return;
 	}
 
 	/* pass on to the driver specific version of this function */
 	if (port->serial->type->unthrottle)
 		port->serial->type->unthrottle(port);
-
-exit:
-	;
 }
 
 static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg)
@@ -681,15 +675,12 @@ static void serial_set_termios (struct t
 
 	if (!port->open_count) {
 		dbg("%s - port not open", __FUNCTION__);
-		goto exit;
+		return;
 	}
 
 	/* pass on to the driver specific version of this function if it is available */
 	if (port->serial->type->set_termios)
 		port->serial->type->set_termios(port, old);
-
-exit:
-	;
 }
 
 static void serial_break (struct tty_struct *tty, int break_state)
@@ -700,15 +691,12 @@ static void serial_break (struct tty_str
 
 	if (!port->open_count) {
 		dbg("%s - port not open", __FUNCTION__);
-		goto exit;
+		return;
 	}
 
 	/* pass on to the driver specific version of this function if it is available */
 	if (port->serial->type->break_ctl)
 		port->serial->type->break_ctl(port, break_state);
-
-exit:
-	;
 }
 
 static int serial_read_proc (char *page, char **start, off_t off, int count, int *eof, void *data)
#1 lore raw
Quoted 8 lines · Luiz Fernando N. Capitulino

Greg,

This patch removes ugly code from some function in usb/serial/usb-serial.c
which is using a goto statement intead of a simple `return'.

To be true, I'm not certain if there is a special reason to do that, if so
ignore me. ;)

No, that's a hold over from a fix a long time ago that got rid of some locks that used to be freed in the exit code.

Thanks for the patch, I've applied it to my trees.

greg k-h