linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs
@ 2019-07-29  0:06 Gustavo A. R. Silva
  2019-07-29 16:36 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-29  0:06 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, Gustavo A. R. Silva, Stephen Rothwell,
	Kees Cook

Mark switch cases where we are expecting to fall through.

This patch fixes the following warnings:

drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8500_usb_link_status_update':
drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   event = UX500_MUSB_RIDB;
   ~~~~~~^~~~~~~~~~~~~~~~~
drivers/usb/phy/phy-ab8500-usb.c:425:2: note: here
  case USB_LINK_NOT_CONFIGURED_8500:
  ^~~~
drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   event = UX500_MUSB_RIDC;
   ~~~~~~^~~~~~~~~~~~~~~~~
drivers/usb/phy/phy-ab8500-usb.c:441:2: note: here
  case USB_LINK_STD_HOST_NC_8500:
  ^~~~
drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   event = UX500_MUSB_RIDA;
   ~~~~~~^~~~~~~~~~~~~~~~~
drivers/usb/phy/phy-ab8500-usb.c:460:2: note: here
  case USB_LINK_HM_IDGND_8500:
  ^~~~
drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8505_usb_link_status_update':
drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   event = UX500_MUSB_RIDB;
   ~~~~~~^~~~~~~~~~~~~~~~~
drivers/usb/phy/phy-ab8500-usb.c:333:2: note: here
  case USB_LINK_NOT_CONFIGURED_8505:
  ^~~~
drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   event = UX500_MUSB_RIDC;
   ~~~~~~^~~~~~~~~~~~~~~~~
drivers/usb/phy/phy-ab8500-usb.c:353:2: note: here
  case USB_LINK_STD_HOST_NC_8505:
  ^~~~
drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
   event = UX500_MUSB_RIDA;
   ~~~~~~^~~~~~~~~~~~~~~~~
drivers/usb/phy/phy-ab8500-usb.c:371:2: note: here
  case USB_LINK_HM_IDGND_8505:
  ^~~~

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/usb/phy/phy-ab8500-usb.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index aaf363f19714..14b432982fd3 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -330,6 +330,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
 	switch (lsts) {
 	case USB_LINK_ACA_RID_B_8505:
 		event = UX500_MUSB_RIDB;
+		/* Fall through */
 	case USB_LINK_NOT_CONFIGURED_8505:
 	case USB_LINK_RESERVED0_8505:
 	case USB_LINK_RESERVED1_8505:
@@ -350,6 +351,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
 
 	case USB_LINK_ACA_RID_C_NM_8505:
 		event = UX500_MUSB_RIDC;
+		/* Fall through */
 	case USB_LINK_STD_HOST_NC_8505:
 	case USB_LINK_STD_HOST_C_NS_8505:
 	case USB_LINK_STD_HOST_C_S_8505:
@@ -368,6 +370,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
 	case USB_LINK_ACA_RID_A_8505:
 	case USB_LINK_ACA_DOCK_CHGR_8505:
 		event = UX500_MUSB_RIDA;
+		/* Fall through */
 	case USB_LINK_HM_IDGND_8505:
 		if (ab->mode == USB_IDLE) {
 			ab->mode = USB_HOST;
@@ -422,6 +425,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
 	switch (lsts) {
 	case USB_LINK_ACA_RID_B_8500:
 		event = UX500_MUSB_RIDB;
+		/* Fall through */
 	case USB_LINK_NOT_CONFIGURED_8500:
 	case USB_LINK_NOT_VALID_LINK_8500:
 		ab->mode = USB_IDLE;
@@ -438,6 +442,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
 	case USB_LINK_ACA_RID_C_HS_8500:
 	case USB_LINK_ACA_RID_C_HS_CHIRP_8500:
 		event = UX500_MUSB_RIDC;
+		/* Fall through */
 	case USB_LINK_STD_HOST_NC_8500:
 	case USB_LINK_STD_HOST_C_NS_8500:
 	case USB_LINK_STD_HOST_C_S_8500:
@@ -457,6 +462,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
 
 	case USB_LINK_ACA_RID_A_8500:
 		event = UX500_MUSB_RIDA;
+		/* Fall through */
 	case USB_LINK_HM_IDGND_8500:
 		if (ab->mode == USB_IDLE) {
 			ab->mode = USB_HOST;
-- 
2.22.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs
  2019-07-29  0:06 [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-29 16:36 ` Kees Cook
  2019-09-13 18:00   ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2019-07-29 16:36 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Felipe Balbi, Greg Kroah-Hartman, linux-usb, linux-kernel,
	Stephen Rothwell

On Sun, Jul 28, 2019 at 07:06:31PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warnings:
> 
> drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8500_usb_link_status_update':
> drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    event = UX500_MUSB_RIDB;
>    ~~~~~~^~~~~~~~~~~~~~~~~
> drivers/usb/phy/phy-ab8500-usb.c:425:2: note: here
>   case USB_LINK_NOT_CONFIGURED_8500:
>   ^~~~
> drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    event = UX500_MUSB_RIDC;
>    ~~~~~~^~~~~~~~~~~~~~~~~
> drivers/usb/phy/phy-ab8500-usb.c:441:2: note: here
>   case USB_LINK_STD_HOST_NC_8500:
>   ^~~~
> drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    event = UX500_MUSB_RIDA;
>    ~~~~~~^~~~~~~~~~~~~~~~~
> drivers/usb/phy/phy-ab8500-usb.c:460:2: note: here
>   case USB_LINK_HM_IDGND_8500:
>   ^~~~
> drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8505_usb_link_status_update':
> drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    event = UX500_MUSB_RIDB;
>    ~~~~~~^~~~~~~~~~~~~~~~~
> drivers/usb/phy/phy-ab8500-usb.c:333:2: note: here
>   case USB_LINK_NOT_CONFIGURED_8505:
>   ^~~~
> drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    event = UX500_MUSB_RIDC;
>    ~~~~~~^~~~~~~~~~~~~~~~~
> drivers/usb/phy/phy-ab8500-usb.c:353:2: note: here
>   case USB_LINK_STD_HOST_NC_8505:
>   ^~~~
> drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    event = UX500_MUSB_RIDA;
>    ~~~~~~^~~~~~~~~~~~~~~~~
> drivers/usb/phy/phy-ab8500-usb.c:371:2: note: here
>   case USB_LINK_HM_IDGND_8505:
>   ^~~~
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  drivers/usb/phy/phy-ab8500-usb.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
> index aaf363f19714..14b432982fd3 100644
> --- a/drivers/usb/phy/phy-ab8500-usb.c
> +++ b/drivers/usb/phy/phy-ab8500-usb.c
> @@ -330,6 +330,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
>  	switch (lsts) {
>  	case USB_LINK_ACA_RID_B_8505:
>  		event = UX500_MUSB_RIDB;
> +		/* Fall through */
>  	case USB_LINK_NOT_CONFIGURED_8505:
>  	case USB_LINK_RESERVED0_8505:
>  	case USB_LINK_RESERVED1_8505:
> @@ -350,6 +351,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
>  
>  	case USB_LINK_ACA_RID_C_NM_8505:
>  		event = UX500_MUSB_RIDC;
> +		/* Fall through */
>  	case USB_LINK_STD_HOST_NC_8505:
>  	case USB_LINK_STD_HOST_C_NS_8505:
>  	case USB_LINK_STD_HOST_C_S_8505:
> @@ -368,6 +370,7 @@ static int ab8505_usb_link_status_update(struct ab8500_usb *ab,
>  	case USB_LINK_ACA_RID_A_8505:
>  	case USB_LINK_ACA_DOCK_CHGR_8505:
>  		event = UX500_MUSB_RIDA;
> +		/* Fall through */
>  	case USB_LINK_HM_IDGND_8505:
>  		if (ab->mode == USB_IDLE) {
>  			ab->mode = USB_HOST;
> @@ -422,6 +425,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
>  	switch (lsts) {
>  	case USB_LINK_ACA_RID_B_8500:
>  		event = UX500_MUSB_RIDB;
> +		/* Fall through */
>  	case USB_LINK_NOT_CONFIGURED_8500:
>  	case USB_LINK_NOT_VALID_LINK_8500:
>  		ab->mode = USB_IDLE;
> @@ -438,6 +442,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
>  	case USB_LINK_ACA_RID_C_HS_8500:
>  	case USB_LINK_ACA_RID_C_HS_CHIRP_8500:
>  		event = UX500_MUSB_RIDC;
> +		/* Fall through */
>  	case USB_LINK_STD_HOST_NC_8500:
>  	case USB_LINK_STD_HOST_C_NS_8500:
>  	case USB_LINK_STD_HOST_C_S_8500:
> @@ -457,6 +462,7 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab,
>  
>  	case USB_LINK_ACA_RID_A_8500:
>  		event = UX500_MUSB_RIDA;
> +		/* Fall through */
>  	case USB_LINK_HM_IDGND_8500:
>  		if (ab->mode == USB_IDLE) {
>  			ab->mode = USB_HOST;
> -- 
> 2.22.0
> 

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs
  2019-07-29 16:36 ` Kees Cook
@ 2019-09-13 18:00   ` Olof Johansson
  2019-09-13 18:01     ` Olof Johansson
  0 siblings, 1 reply; 4+ messages in thread
From: Olof Johansson @ 2019-09-13 18:00 UTC (permalink / raw)
  To: Kees Cook
  Cc: Gustavo A. R. Silva, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
	Linux Kernel Mailing List, Stephen Rothwell

On Mon, Jul 29, 2019 at 5:36 PM Kees Cook <keescook@chromium.org> wrote:
>
> On Sun, Jul 28, 2019 at 07:06:31PM -0500, Gustavo A. R. Silva wrote:
> > Mark switch cases where we are expecting to fall through.
> >
> > This patch fixes the following warnings:
> >
> > drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8500_usb_link_status_update':
> > drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >    event = UX500_MUSB_RIDB;
> >    ~~~~~~^~~~~~~~~~~~~~~~~
> > drivers/usb/phy/phy-ab8500-usb.c:425:2: note: here
> >   case USB_LINK_NOT_CONFIGURED_8500:
> >   ^~~~
> > drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >    event = UX500_MUSB_RIDC;
> >    ~~~~~~^~~~~~~~~~~~~~~~~
> > drivers/usb/phy/phy-ab8500-usb.c:441:2: note: here
> >   case USB_LINK_STD_HOST_NC_8500:
> >   ^~~~
> > drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >    event = UX500_MUSB_RIDA;
> >    ~~~~~~^~~~~~~~~~~~~~~~~
> > drivers/usb/phy/phy-ab8500-usb.c:460:2: note: here
> >   case USB_LINK_HM_IDGND_8500:
> >   ^~~~
> > drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8505_usb_link_status_update':
> > drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >    event = UX500_MUSB_RIDB;
> >    ~~~~~~^~~~~~~~~~~~~~~~~
> > drivers/usb/phy/phy-ab8500-usb.c:333:2: note: here
> >   case USB_LINK_NOT_CONFIGURED_8505:
> >   ^~~~
> > drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >    event = UX500_MUSB_RIDC;
> >    ~~~~~~^~~~~~~~~~~~~~~~~
> > drivers/usb/phy/phy-ab8500-usb.c:353:2: note: here
> >   case USB_LINK_STD_HOST_NC_8505:
> >   ^~~~
> > drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> >    event = UX500_MUSB_RIDA;
> >    ~~~~~~^~~~~~~~~~~~~~~~~
> > drivers/usb/phy/phy-ab8500-usb.c:371:2: note: here
> >   case USB_LINK_HM_IDGND_8505:
> >   ^~~~
> >
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>
> Reviewed-by: Kees Cook <keescook@chromium.org>

Acked-by: Olof Johansson <olof@lixom.net>

Felipe, Greg, this is still throwing warnings, several months later --
patch was never applied.

Mind picking it up as a fix to get a quieter build?


Thanks,

-Olof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs
  2019-09-13 18:00   ` Olof Johansson
@ 2019-09-13 18:01     ` Olof Johansson
  0 siblings, 0 replies; 4+ messages in thread
From: Olof Johansson @ 2019-09-13 18:01 UTC (permalink / raw)
  To: Kees Cook
  Cc: Gustavo A. R. Silva, Felipe Balbi, Greg Kroah-Hartman, linux-usb,
	Linux Kernel Mailing List, Stephen Rothwell

On Fri, Sep 13, 2019 at 7:00 PM Olof Johansson <olof@lixom.net> wrote:
>
> On Mon, Jul 29, 2019 at 5:36 PM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Sun, Jul 28, 2019 at 07:06:31PM -0500, Gustavo A. R. Silva wrote:
> > > Mark switch cases where we are expecting to fall through.
> > >
> > > This patch fixes the following warnings:
> > >
> > > drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8500_usb_link_status_update':
> > > drivers/usb/phy/phy-ab8500-usb.c:424:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > >    event = UX500_MUSB_RIDB;
> > >    ~~~~~~^~~~~~~~~~~~~~~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:425:2: note: here
> > >   case USB_LINK_NOT_CONFIGURED_8500:
> > >   ^~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:440:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > >    event = UX500_MUSB_RIDC;
> > >    ~~~~~~^~~~~~~~~~~~~~~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:441:2: note: here
> > >   case USB_LINK_STD_HOST_NC_8500:
> > >   ^~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:459:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > >    event = UX500_MUSB_RIDA;
> > >    ~~~~~~^~~~~~~~~~~~~~~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:460:2: note: here
> > >   case USB_LINK_HM_IDGND_8500:
> > >   ^~~~
> > > drivers/usb/phy/phy-ab8500-usb.c: In function 'ab8505_usb_link_status_update':
> > > drivers/usb/phy/phy-ab8500-usb.c:332:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > >    event = UX500_MUSB_RIDB;
> > >    ~~~~~~^~~~~~~~~~~~~~~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:333:2: note: here
> > >   case USB_LINK_NOT_CONFIGURED_8505:
> > >   ^~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:352:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > >    event = UX500_MUSB_RIDC;
> > >    ~~~~~~^~~~~~~~~~~~~~~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:353:2: note: here
> > >   case USB_LINK_STD_HOST_NC_8505:
> > >   ^~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:370:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> > >    event = UX500_MUSB_RIDA;
> > >    ~~~~~~^~~~~~~~~~~~~~~~~
> > > drivers/usb/phy/phy-ab8500-usb.c:371:2: note: here
> > >   case USB_LINK_HM_IDGND_8505:
> > >   ^~~~
> > >
> > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> >
> > Reviewed-by: Kees Cook <keescook@chromium.org>
>
> Acked-by: Olof Johansson <olof@lixom.net>
>
> Felipe, Greg, this is still throwing warnings, several months later --
> patch was never applied.
>
> Mind picking it up as a fix to get a quieter build?

Nevermind, I see they're gone from -next, so at least it's queued for
next merge window. Sorry for the noise.


-Olof

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-09-13 18:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29  0:06 [PATCH] usb: phy: ab8500-usb: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 16:36 ` Kees Cook
2019-09-13 18:00   ` Olof Johansson
2019-09-13 18:01     ` Olof Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).