All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: David Laight <David.Laight@aculab.com>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>
Subject: usbip: vhci_hcd: Mark expected switch fall-through
Date: Tue, 30 Apr 2019 17:44:44 +0200	[thread overview]
Message-ID: <20190430154444.GA4224@kroah.com> (raw)

On Mon, Apr 29, 2019 at 10:05:51AM -0500, Gustavo A. R. Silva wrote:
> 
> 
> On 4/29/19 9:44 AM, David Laight wrote:
> > From: Gustavo A. R. Silva
> >> Sent: 29 April 2019 15:40
> >> In preparation to enabling -Wimplicit-fallthrough, mark switch
> >> cases where we are expecting to fall through.
> > ...
> >> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
> >> index 667d9c0ec905..000ab7225717 100644
> >> --- a/drivers/usb/usbip/vhci_hcd.c
> >> +++ b/drivers/usb/usbip/vhci_hcd.c
> >> @@ -508,6 +508,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> >>  		case USB_PORT_FEAT_U1_TIMEOUT:
> >>  			usbip_dbg_vhci_rh(
> >>  				" SetPortFeature: USB_PORT_FEAT_U1_TIMEOUT\n");
> >> +			/* Fall through */
> >>  		case USB_PORT_FEAT_U2_TIMEOUT:
> >>  			usbip_dbg_vhci_rh(
> >>  				" SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
> > 
> > That doesn't look right, both debug messages seem to get printed.
> > 
> 
> At first sight, I thought the same way, then I took a look into
> commit:
> 
> 1c9de5bf428612458427943b724bea51abde520a
> 
> and noticed that the original developer properly added fall-through
> comments in other places in the same switch() code, that gave me the
> impression he knew what he was doing; then I noticed the following
> error message in case USB_PORT_FEAT_U2_TIMEOUT:
> 
> 	if (hcd->speed != HCD_USB3) {
> 		pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not "
> 		       "supported for USB 2.0 roothub\n");
> 		goto error;
> 	}
> 
> this error message is what makes me think the fall-through is
> intentional; otherwise I think it would look like this instead:
> 
> 	if (hcd->speed != HCD_USB3) {
> 		pr_err("USB_PORT_FEAT_U2_TIMEOUT req not "
> 		       "supported for USB 2.0 roothub\n");
> 		goto error;
> 	}

I think you are right, that's horrid, but correct :(

Will go queue this up, thanks.

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: David Laight <David.Laight@aculab.com>,
	Valentina Manea <valentina.manea.m@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH] usbip: vhci_hcd: Mark expected switch fall-through
Date: Tue, 30 Apr 2019 17:44:44 +0200	[thread overview]
Message-ID: <20190430154444.GA4224@kroah.com> (raw)
Message-ID: <20190430154444.igHROpPtc6QcZmtgxbIQsOumXs9InKWuMsYwd2_wBQU@z> (raw)
In-Reply-To: <287c8504-eafa-ebbb-aa39-babb86fdeb94@embeddedor.com>

On Mon, Apr 29, 2019 at 10:05:51AM -0500, Gustavo A. R. Silva wrote:
> 
> 
> On 4/29/19 9:44 AM, David Laight wrote:
> > From: Gustavo A. R. Silva
> >> Sent: 29 April 2019 15:40
> >> In preparation to enabling -Wimplicit-fallthrough, mark switch
> >> cases where we are expecting to fall through.
> > ...
> >> diff --git a/drivers/usb/usbip/vhci_hcd.c b/drivers/usb/usbip/vhci_hcd.c
> >> index 667d9c0ec905..000ab7225717 100644
> >> --- a/drivers/usb/usbip/vhci_hcd.c
> >> +++ b/drivers/usb/usbip/vhci_hcd.c
> >> @@ -508,6 +508,7 @@ static int vhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
> >>  		case USB_PORT_FEAT_U1_TIMEOUT:
> >>  			usbip_dbg_vhci_rh(
> >>  				" SetPortFeature: USB_PORT_FEAT_U1_TIMEOUT\n");
> >> +			/* Fall through */
> >>  		case USB_PORT_FEAT_U2_TIMEOUT:
> >>  			usbip_dbg_vhci_rh(
> >>  				" SetPortFeature: USB_PORT_FEAT_U2_TIMEOUT\n");
> > 
> > That doesn't look right, both debug messages seem to get printed.
> > 
> 
> At first sight, I thought the same way, then I took a look into
> commit:
> 
> 1c9de5bf428612458427943b724bea51abde520a
> 
> and noticed that the original developer properly added fall-through
> comments in other places in the same switch() code, that gave me the
> impression he knew what he was doing; then I noticed the following
> error message in case USB_PORT_FEAT_U2_TIMEOUT:
> 
> 	if (hcd->speed != HCD_USB3) {
> 		pr_err("USB_PORT_FEAT_U1/2_TIMEOUT req not "
> 		       "supported for USB 2.0 roothub\n");
> 		goto error;
> 	}
> 
> this error message is what makes me think the fall-through is
> intentional; otherwise I think it would look like this instead:
> 
> 	if (hcd->speed != HCD_USB3) {
> 		pr_err("USB_PORT_FEAT_U2_TIMEOUT req not "
> 		       "supported for USB 2.0 roothub\n");
> 		goto error;
> 	}

I think you are right, that's horrid, but correct :(

Will go queue this up, thanks.

greg k-h

             reply	other threads:[~2019-04-30 15:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30 15:44 Greg Kroah-Hartman [this message]
2019-04-30 15:44 ` [PATCH] usbip: vhci_hcd: Mark expected switch fall-through Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2019-04-30 17:38 Gustavo A. R. Silva
2019-04-30 17:38 ` [PATCH] " Gustavo A. R. Silva
2019-04-30 15:49 Shuah Khan
2019-04-30 15:49 ` [PATCH] " shuah
2019-04-29 15:34 David Laight
2019-04-29 15:34 ` [PATCH] " David Laight
2019-04-29 14:39 Gustavo A. R. Silva
2019-04-29 14:39 ` [PATCH] " Gustavo A. R. Silva
2019-04-29 14:44 ` David Laight
2019-04-29 15:05   ` Gustavo A. R. Silva

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=20190430154444.GA4224@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=David.Laight@aculab.com \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=valentina.manea.m@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.