From: Nathan Chancellor <natechancellor@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Gustavo A . R . Silva" <gustavoars@kernel.org>,
Alan Stern <stern@rowland.harvard.edu>,
Mathias Nyman <mathias.nyman@intel.com>,
Johan Hovold <johan@kernel.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
clang-built-linux@googlegroups.com
Subject: Re: [PATCH] usb: fix a few cases of -Wfallthrough
Date: Thu, 12 Nov 2020 11:00:06 -0700 [thread overview]
Message-ID: <20201112180006.GA934688@ubuntu-m3-large-x86> (raw)
In-Reply-To: <20201111014716.260633-1-ndesaulniers@google.com>
On Tue, Nov 10, 2020 at 05:47:14PM -0800, Nick Desaulniers wrote:
> 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 <ndesaulniers@google.com>
Aside from a minor nit/question below:
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> 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(-)
>
> diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
> index 562a730befda..b199eb65f378 100644
> --- a/drivers/usb/core/config.c
> +++ b/drivers/usb/core/config.c
> @@ -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;
> }
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 3575b7201881..e358ae17d51e 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -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.
> /* case PIPE_BULK: */
> default:
> if (!qh_urb_transaction (ehci, urb, &qtd_list, mem_flags))
> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
> index 73e13e7c2b46..1f5e69314a17 100644
> --- a/drivers/usb/host/ohci-hcd.c
> +++ b/drivers/usb/host/ohci-hcd.c
> @@ -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:
> diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
> index 44504c1751e0..f474f2f9c1e4 100644
> --- a/drivers/usb/host/ohci-hub.c
> +++ b/drivers/usb/host/ohci-hub.c
> @@ -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:
> diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
> index 167dae117f73..eac43a7b7f23 100644
> --- a/drivers/usb/host/xhci-ring.c
> +++ b/drivers/usb/host/xhci-ring.c
> @@ -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;
> --
> 2.29.2.222.g5d2a92d10f8-goog
>
prev parent reply other threads:[~2020-11-12 18:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-11 1:47 Nick Desaulniers
2020-11-12 18:00 ` Nathan Chancellor [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201112180006.GA934688@ubuntu-m3-large-x86 \
--to=natechancellor@gmail.com \
--cc=clang-built-linux@googlegroups.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavoars@kernel.org \
--cc=johan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=ndesaulniers@google.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®