usb: remove unneeded break
Subsystems (4)
PATCH 1/1 usb: remove unneeded break
From: Tom Rix <[email protected]>
A break is not needed if it is preceded by a return or goto
Signed-off-by Tom Rix <[email protected]>
--- drivers/usb/gadget/function/f_hid.c | 9 --------- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/misc/iowarrior.c | 3 --- drivers/usb/serial/iuu_phoenix.c | 2 -- drivers/usb/storage/freecom.c | 1 - 5 files changed, 16 deletions(-)
drivers/usb/gadget/function/f_hid.c +0 -9
@@ -511,9 +511,7 @@ static int hidg_setup(struct usb_function *f,/* send an empty report */ length =min_t (unsigned, length, hidg->report_length);memset (req->buf,0x0 , length); - goto respond; -break ;case ((USB_DIR_IN |USB_TYPE_CLASS |USB_RECIP_INTERFACE ) <<8 |HID_REQ_GET_PROTOCOL ):
@@ -521,13 +519,11 @@ static int hidg_setup(struct usb_function *f, length = min_t(unsigned int, length, 1); ((u8 *) req->buf)[0 ] = hidg->protocol; goto respond; -break ;case ((USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE ) <<8 |HID_REQ_SET_REPORT ):VDBG (cdev,"set_report | wLength=%d\n" , ctrl->wLength); goto stall; -break ;case ((USB_DIR_OUT |USB_TYPE_CLASS |USB_RECIP_INTERFACE ) <<8 |HID_REQ_SET_PROTOCOL ):
@@ -544,7 +540,6 @@ static int hidg_setup(struct usb_function *f, goto respond; } goto stall; -break ;case ((USB_DIR_IN |USB_TYPE_STANDARD |USB_RECIP_INTERFACE ) <<8 |USB_REQ_GET_DESCRIPTOR ):
@@ -562,7 +557,6 @@ static int hidg_setup(struct usb_function *f, hidg_desc_copy.bLength);memcpy (req->buf, &hidg_desc_copy, length); goto respond; -break ; }case HID_DT_REPORT :VDBG (cdev,"USB_REQ_GET_DESCRIPTOR: REPORT\n" );
@@ -570,13 +564,11 @@ static int hidg_setup(struct usb_function *f, hidg->report_desc_length);memcpy (req->buf, hidg->report_desc, length); goto respond; -break ;default :VDBG (cdev,"Unknown descriptor request 0x%x\n" , value >>8 ); goto stall; -break ; }break ;
@@ -584,7 +576,6 @@ static int hidg_setup(struct usb_function *f,VDBG (cdev,"Unknown request 0x%x\n" , ctrl->bRequest); goto stall; -break ; } stall:
drivers/usb/host/xhci-mem.c +0 -1
@@ -1144,7 +1144,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udcase USB_SPEED_WIRELESS :xhci_dbg (xhci,"FIXME xHCI doesn't support wireless speeds\n" );return -EINVAL ; -break ;default :/* Speed was set earlier, this shouldn't happen. */ return -EINVAL ;
drivers/usb/misc/iowarrior.c +0 -3
@@ -384,7 +384,6 @@ static ssize_t iowarrior_write(struct file *file, retval =usb_set_report (dev->interface,2 ,0 , buf, count);kfree (buf); goto exit; -break ;case USB_DEVICE_ID_CODEMERCS_IOW56 :case USB_DEVICE_ID_CODEMERCS_IOW56AM :case USB_DEVICE_ID_CODEMERCS_IOW28 :
@@ -454,14 +453,12 @@ static ssize_t iowarrior_write(struct file *file, retval = count;usb_free_urb (int_out_urb); goto exit; -break ;default :/* what do we have here ? An unsupported Product-ID ? */ dev_err (&dev->interface->dev,"%s - not supported for product=0x%x\n" , __func__, dev->product_id); retval = -EFAULT ; goto exit; -break ; } error: usb_free_coherent(dev->udev, dev->report_size, buf,
drivers/usb/serial/iuu_phoenix.c +0 -2
@@ -850,7 +850,6 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base,default :kfree (dataout);return IUU_INVALID_PARAMETER ; -break ; }switch (parity &0xF0 ) {
@@ -864,7 +863,6 @@ static int iuu_uart_baud(struct usb_serial_port *port, u32 baud_base,default :kfree (dataout);return IUU_INVALID_PARAMETER ; -break ; } status =bulk_immediate (port, dataout, DataCount);
drivers/usb/storage/freecom.c +0 -1
@@ -431,7 +431,6 @@ static int freecom_transport(struct scsi_cmnd *srb, struct us_data *us) us->srb->sc_data_direction);/* Return fail, SCSI seems to handle this better. */ return USB_STOR_TRANSPORT_FAILED ; -break ; }return USB_STOR_TRANSPORT_GOOD ;
Signature · 1 line
2.18.1
Quoted 4 lines · On 19.10.2020 18.02, [email protected] wrote:
From: Tom Rix <[email protected]>
A break is not needed if it is preceded by a return or goto
Quoted 8 lines
Signed-off-by Tom Rix <[email protected]>--- drivers/usb/gadget/function/f_hid.c | 9 --------- drivers/usb/host/xhci-mem.c | 1 - drivers/usb/misc/iowarrior.c | 3 --- drivers/usb/serial/iuu_phoenix.c | 2 -- drivers/usb/storage/freecom.c | 1 - 5 files changed, 16 deletions(-)
Would probably be better to split this into several patches. The xhci change looks good (as a separate patch)
-Mathias