linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qlogicpti: Mark expected switch fall-throughs
@ 2019-07-29 11:03 Gustavo A. R. Silva
  2019-07-29 15:59 ` Kees Cook
  2019-08-08  1:33 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-29 11:03 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, 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 (Building: sparc defconfig):

drivers/scsi/qlogicpti.c: In function 'qlogicpti_mbox_command':
drivers/scsi/qlogicpti.c:202:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:203:2: note: here
  case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
  ^~~~
drivers/scsi/qlogicpti.c:203:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:204:2: note: here
  case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
  ^~~~
drivers/scsi/qlogicpti.c:204:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:205:2: note: here
  case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
  ^~~~
drivers/scsi/qlogicpti.c:205:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:206:2: note: here
  case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
  ^~~~
drivers/scsi/qlogicpti.c:206:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:207:2: note: here
  case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
  ^~~~
drivers/scsi/qlogicpti.c:256:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:257:2: note: here
  case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
  ^~~~
drivers/scsi/qlogicpti.c:257:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:258:2: note: here
  case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
  ^~~~
drivers/scsi/qlogicpti.c:258:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:259:2: note: here
  case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
  ^~~~
drivers/scsi/qlogicpti.c:259:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:260:2: note: here
  case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
  ^~~~
drivers/scsi/qlogicpti.c:260:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
  case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
          ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/qlogicpti.c:261:2: note: here
  case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
  ^~~~

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

diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
index 9335849f6bea..d539beef3ce8 100644
--- a/drivers/scsi/qlogicpti.c
+++ b/drivers/scsi/qlogicpti.c
@@ -200,10 +200,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
 	/* Write mailbox command registers. */
 	switch (mbox_param[param[0]] >> 4) {
 	case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
+		/* Fall through */
 	case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
+		/* Fall through */
 	case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
+		/* Fall through */
 	case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
+		/* Fall through */
 	case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
+		/* Fall through */
 	case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
 	}
 
@@ -254,10 +259,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
 	/* Read back output parameters. */
 	switch (mbox_param[param[0]] & 0xf) {
 	case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
+		/* Fall through */
 	case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
+		/* Fall through */
 	case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
+		/* Fall through */
 	case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
+		/* Fall through */
 	case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
+		/* Fall through */
 	case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
 	}
 
-- 
2.22.0


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

* Re: [PATCH] scsi: qlogicpti: Mark expected switch fall-throughs
  2019-07-29 11:03 [PATCH] scsi: qlogicpti: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-29 15:59 ` Kees Cook
  2019-08-08  1:33 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-07-29 15:59 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, Stephen Rothwell

On Mon, Jul 29, 2019 at 06:03:45AM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warnings (Building: sparc defconfig):
> 
> drivers/scsi/qlogicpti.c: In function 'qlogicpti_mbox_command':
> drivers/scsi/qlogicpti.c:202:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:203:2: note: here
>   case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
>   ^~~~
> drivers/scsi/qlogicpti.c:203:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:204:2: note: here
>   case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
>   ^~~~
> drivers/scsi/qlogicpti.c:204:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:205:2: note: here
>   case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
>   ^~~~
> drivers/scsi/qlogicpti.c:205:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:206:2: note: here
>   case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
>   ^~~~
> drivers/scsi/qlogicpti.c:206:10: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:207:2: note: here
>   case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
>   ^~~~
> drivers/scsi/qlogicpti.c:256:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
>           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:257:2: note: here
>   case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
>   ^~~~
> drivers/scsi/qlogicpti.c:257:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
>           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:258:2: note: here
>   case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
>   ^~~~
> drivers/scsi/qlogicpti.c:258:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
>           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:259:2: note: here
>   case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
>   ^~~~
> drivers/scsi/qlogicpti.c:259:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
>           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:260:2: note: here
>   case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
>   ^~~~
> drivers/scsi/qlogicpti.c:260:19: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
>           ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/scsi/qlogicpti.c:261:2: note: here
>   case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
>   ^~~~
> 
> 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/scsi/qlogicpti.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/scsi/qlogicpti.c b/drivers/scsi/qlogicpti.c
> index 9335849f6bea..d539beef3ce8 100644
> --- a/drivers/scsi/qlogicpti.c
> +++ b/drivers/scsi/qlogicpti.c
> @@ -200,10 +200,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
>  	/* Write mailbox command registers. */
>  	switch (mbox_param[param[0]] >> 4) {
>  	case 6: sbus_writew(param[5], qpti->qregs + MBOX5);
> +		/* Fall through */
>  	case 5: sbus_writew(param[4], qpti->qregs + MBOX4);
> +		/* Fall through */
>  	case 4: sbus_writew(param[3], qpti->qregs + MBOX3);
> +		/* Fall through */
>  	case 3: sbus_writew(param[2], qpti->qregs + MBOX2);
> +		/* Fall through */
>  	case 2: sbus_writew(param[1], qpti->qregs + MBOX1);
> +		/* Fall through */
>  	case 1: sbus_writew(param[0], qpti->qregs + MBOX0);
>  	}
>  
> @@ -254,10 +259,15 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
>  	/* Read back output parameters. */
>  	switch (mbox_param[param[0]] & 0xf) {
>  	case 6: param[5] = sbus_readw(qpti->qregs + MBOX5);
> +		/* Fall through */
>  	case 5: param[4] = sbus_readw(qpti->qregs + MBOX4);
> +		/* Fall through */
>  	case 4: param[3] = sbus_readw(qpti->qregs + MBOX3);
> +		/* Fall through */
>  	case 3: param[2] = sbus_readw(qpti->qregs + MBOX2);
> +		/* Fall through */
>  	case 2: param[1] = sbus_readw(qpti->qregs + MBOX1);
> +		/* Fall through */
>  	case 1: param[0] = sbus_readw(qpti->qregs + MBOX0);
>  	}
>  
> -- 
> 2.22.0
> 

-- 
Kees Cook

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

* Re: [PATCH] scsi: qlogicpti: Mark expected switch fall-throughs
  2019-07-29 11:03 [PATCH] scsi: qlogicpti: Mark expected switch fall-throughs Gustavo A. R. Silva
  2019-07-29 15:59 ` Kees Cook
@ 2019-08-08  1:33 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2019-08-08  1:33 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, Stephen Rothwell, Kees Cook


Gustavo,

> Mark switch cases where we are expecting to fall through.
>
> This patch fixes the following warnings (Building: sparc defconfig):

Applied to 5.4/scsi-queue. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2019-08-08  1:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 11:03 [PATCH] scsi: qlogicpti: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-29 15:59 ` Kees Cook
2019-08-08  1:33 ` Martin K. Petersen

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).