usb: fix a few cases of -Wfallthrough
Subsystems (4)
PATCH 1/1 usb: fix a few cases of -Wfallthrough
The "fallthrough" pseudo-keyword was added as a portable way to denote intentional fallthrough. Clang will still warn on cases where there is a fallthrough to an immediate break. Add explicit breaks for those cases.
--- drivers/usb/core/config.c | 1 + drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/ohci-hcd.c | 2 +- drivers/usb/host/ohci-hub.c | 1 + drivers/usb/host/xhci-ring.c | 2 ++ 5 files changed, 6 insertions(+), 2 deletions(-)
drivers/usb/core/config.c +1 -0
@@ -1076,6 +1076,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)case USB_PTM_CAP_TYPE : dev->bos->ptm_cap = (struct usb_ptm_cap_descriptor *)buffer; +break ;default :break ; }
drivers/usb/host/ehci-hcd.c +1 -1
@@ -867,7 +867,7 @@ static int ehci_urb_enqueue (*/ if (urb->transfer_buffer_length > (16 *1024 ))return -EMSGSIZE ; -/* FALLTHROUGH */ + fallthrough;/* case PIPE_BULK: */ default :if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags))
drivers/usb/host/ohci-hcd.c +1 -1
@@ -171,7 +171,7 @@ static int ohci_urb_enqueue (/* 1 TD for setup, 1 for ACK, plus ... */ size =2 ; -/* FALLTHROUGH */ + fallthrough;// case PIPE_INTERRUPT: // case PIPE_BULK: default :
drivers/usb/host/ohci-hub.c +1 -0
@@ -692,6 +692,7 @@ int ohci_hub_control(case C_HUB_OVER_CURRENT :ohci_writel (ohci,RH_HS_OCIC , &ohci->regs->roothub.status); +break ;case C_HUB_LOCAL_POWER :break ;default :
drivers/usb/host/xhci-ring.c +2 -0
@@ -2418,6 +2418,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,xhci_warn_ratelimited (xhci,"WARN Successful completion on short TX for slot %u ep %u: needs XHCI_TRUST_TX_LENGTH quirk?\n" , slot_id, ep_index); +break ;case COMP_SHORT_PACKET :break ;/* Completion codes for endpoint stopped state */
@@ -2962,6 +2963,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,return -EINVAL ;case EP_STATE_HALTED :xhci_dbg (xhci,"WARN halted endpoint, queueing URB anyway.\n" ); +break ;case EP_STATE_STOPPED :case EP_STATE_RUNNING :break ;
Signature · 1 line
2.29.2.222.g5d2a92d10f8-goog
Quoted 5 lines · Nick Desaulniers
The "fallthrough" pseudo-keyword was added as a portable way to denote intentional fallthrough. Clang will still warn on cases where there is a fallthrough to an immediate break. Add explicit breaks for those cases.
Signed-off-by Nick Desaulniers <[email protected]>
Aside from a minor nit/question below:
Quoted 25 lines
--- drivers/usb/core/config.c | 1 + drivers/usb/host/ehci-hcd.c | 2 +- drivers/usb/host/ohci-hcd.c | 2 +- drivers/usb/host/ohci-hub.c | 1 + drivers/usb/host/xhci-ring.c | 2 ++ 5 files changed, 6 insertions(+), 2 deletions(-)drivers/usb/core/config.c +1
-0@@ -1076,6 +1076,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)case USB_PTM_CAP_TYPE : dev->bos->ptm_cap = (struct usb_ptm_cap_descriptor *)buffer; +break ;default :break ; }drivers/usb/host/ehci-hcd.c +0
-0
drivers/usb/host/ehci-hcd.c static int ehci_urb_enqueue ( · line 870
Quoted 5 lines
drivers/usb/host/ehci-hcd.c +1
-1@@ -867,7 +867,7 @@ static int ehci_urb_enqueue (*/ if (urb->transfer_buffer_length > (16 *1024 ))return -EMSGSIZE ; -/* FALLTHROUGH */ + fallthrough;
This is fixing the same kind of warnings but it is not called out in the commit message. Maybe this hunk and the next hunk should be in a separate patch? No strong preference either way.
Quoted 51 lines
drivers/usb/host/ehci-hcd.c +0
-0/* case PIPE_BULK: */ default :if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags))drivers/usb/host/ohci-hcd.c +1
-1@@ -171,7 +171,7 @@ static int ohci_urb_enqueue (/* 1 TD for setup, 1 for ACK, plus ... */ size =2 ; -/* FALLTHROUGH */ + fallthrough;// case PIPE_INTERRUPT: // case PIPE_BULK: default :drivers/usb/host/ohci-hub.c +1
-0@@ -692,6 +692,7 @@ int ohci_hub_control(case C_HUB_OVER_CURRENT :ohci_writel (ohci,RH_HS_OCIC , &ohci->regs->roothub.status); +break ;case C_HUB_LOCAL_POWER :break ;default :drivers/usb/host/xhci-ring.c +2
-0@@ -2418,6 +2418,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,xhci_warn_ratelimited (xhci,"WARN Successful completion on short TX for slot %u ep %u: needs XHCI_TRUST_TX_LENGTH quirk?\n" , slot_id, ep_index); +break ;case COMP_SHORT_PACKET :break ;/* Completion codes for endpoint stopped state */ @@ -2962,6 +2963,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,return -EINVAL ;case EP_STATE_HALTED :xhci_dbg (xhci,"WARN halted endpoint, queueing URB anyway.\n" ); +break ;case EP_STATE_STOPPED :case EP_STATE_RUNNING :break ;Signature · 1 line
2.29.2.222.g5d2a92d10f8-goog