All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] HSI: ssi_protocol: Mark expected switch fall-throughs
@ 2019-07-29 22:45 Gustavo A. R. Silva
  2019-07-30 16:58 ` Kees Cook
  2019-07-30 20:15 ` Sebastian Reichel
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-07-29 22:45 UTC (permalink / raw)
  To: Sebastian Reichel; +Cc: linux-kernel, Gustavo A. R. Silva, Kees Cook

Mark switch cases where we are expecting to fall through.

This patch fixes the following warning (Building: arm):

drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_set_rxstate’:
drivers/hsi/clients/ssi_protocol.c:291:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
   if (atomic_read(&ssi->tx_usecnt))
      ^
drivers/hsi/clients/ssi_protocol.c:294:2: note: here
  case RECEIVING:
  ^~~~

drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_keep_alive’:
drivers/hsi/clients/ssi_protocol.c:466:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
    if (atomic_read(&ssi->tx_usecnt) == 0)
       ^
drivers/hsi/clients/ssi_protocol.c:472:3: note: here
   case SEND_IDLE:
   ^~~~

Notice that, in this particular case, the code comment is
modified in accordance with what GCC is expecting to find.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/hsi/clients/ssi_protocol.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
index 9aeed98b87a1..504d00ec1ea7 100644
--- a/drivers/hsi/clients/ssi_protocol.c
+++ b/drivers/hsi/clients/ssi_protocol.c
@@ -290,7 +290,7 @@ static void ssip_set_rxstate(struct ssi_protocol *ssi, unsigned int state)
 		/* CMT speech workaround */
 		if (atomic_read(&ssi->tx_usecnt))
 			break;
-		/* Otherwise fall through */
+		/* Else, fall through */
 	case RECEIVING:
 		mod_timer(&ssi->keep_alive, jiffies +
 						msecs_to_jiffies(SSIP_KATOUT));
@@ -465,9 +465,10 @@ static void ssip_keep_alive(struct timer_list *t)
 		case SEND_READY:
 			if (atomic_read(&ssi->tx_usecnt) == 0)
 				break;
+			/* Fall through */
 			/*
-			 * Fall through. Workaround for cmt-speech
-			 * in that case we relay on audio timers.
+			 * Workaround for cmt-speech in that case
+			 * we relay on audio timers.
 			 */
 		case SEND_IDLE:
 			spin_unlock(&ssi->lock);
-- 
2.22.0


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

* Re: [PATCH] HSI: ssi_protocol: Mark expected switch fall-throughs
  2019-07-29 22:45 [PATCH] HSI: ssi_protocol: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-07-30 16:58 ` Kees Cook
  2019-07-30 20:15 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-07-30 16:58 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Sebastian Reichel, linux-kernel

On Mon, Jul 29, 2019 at 05:45:19PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warning (Building: arm):
> 
> drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_set_rxstate’:
> drivers/hsi/clients/ssi_protocol.c:291:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (atomic_read(&ssi->tx_usecnt))
>       ^
> drivers/hsi/clients/ssi_protocol.c:294:2: note: here
>   case RECEIVING:
>   ^~~~
> 
> drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_keep_alive’:
> drivers/hsi/clients/ssi_protocol.c:466:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     if (atomic_read(&ssi->tx_usecnt) == 0)
>        ^
> drivers/hsi/clients/ssi_protocol.c:472:3: note: here
>    case SEND_IDLE:
>    ^~~~
> 
> Notice that, in this particular case, the code comment is
> modified in accordance with what GCC is expecting to find.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

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

-Kees

> ---
>  drivers/hsi/clients/ssi_protocol.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
> index 9aeed98b87a1..504d00ec1ea7 100644
> --- a/drivers/hsi/clients/ssi_protocol.c
> +++ b/drivers/hsi/clients/ssi_protocol.c
> @@ -290,7 +290,7 @@ static void ssip_set_rxstate(struct ssi_protocol *ssi, unsigned int state)
>  		/* CMT speech workaround */
>  		if (atomic_read(&ssi->tx_usecnt))
>  			break;
> -		/* Otherwise fall through */
> +		/* Else, fall through */
>  	case RECEIVING:
>  		mod_timer(&ssi->keep_alive, jiffies +
>  						msecs_to_jiffies(SSIP_KATOUT));
> @@ -465,9 +465,10 @@ static void ssip_keep_alive(struct timer_list *t)
>  		case SEND_READY:
>  			if (atomic_read(&ssi->tx_usecnt) == 0)
>  				break;
> +			/* Fall through */
>  			/*
> -			 * Fall through. Workaround for cmt-speech
> -			 * in that case we relay on audio timers.
> +			 * Workaround for cmt-speech in that case
> +			 * we relay on audio timers.
>  			 */
>  		case SEND_IDLE:
>  			spin_unlock(&ssi->lock);
> -- 
> 2.22.0
> 

-- 
Kees Cook

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

* Re: [PATCH] HSI: ssi_protocol: Mark expected switch fall-throughs
  2019-07-29 22:45 [PATCH] HSI: ssi_protocol: Mark expected switch fall-throughs Gustavo A. R. Silva
  2019-07-30 16:58 ` Kees Cook
@ 2019-07-30 20:15 ` Sebastian Reichel
  1 sibling, 0 replies; 3+ messages in thread
From: Sebastian Reichel @ 2019-07-30 20:15 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: linux-kernel, Kees Cook

[-- Attachment #1: Type: text/plain, Size: 2266 bytes --]

Hi,

On Mon, Jul 29, 2019 at 05:45:19PM -0500, Gustavo A. R. Silva wrote:
> Mark switch cases where we are expecting to fall through.
> 
> This patch fixes the following warning (Building: arm):
> 
> drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_set_rxstate’:
> drivers/hsi/clients/ssi_protocol.c:291:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    if (atomic_read(&ssi->tx_usecnt))
>       ^
> drivers/hsi/clients/ssi_protocol.c:294:2: note: here
>   case RECEIVING:
>   ^~~~
> 
> drivers/hsi/clients/ssi_protocol.c: In function ‘ssip_keep_alive’:
> drivers/hsi/clients/ssi_protocol.c:466:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
>     if (atomic_read(&ssi->tx_usecnt) == 0)
>        ^
> drivers/hsi/clients/ssi_protocol.c:472:3: note: here
>    case SEND_IDLE:
>    ^~~~
> 
> Notice that, in this particular case, the code comment is
> modified in accordance with what GCC is expecting to find.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---

Thanks, queued to hsi-next.

-- Sebastian

>  drivers/hsi/clients/ssi_protocol.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hsi/clients/ssi_protocol.c b/drivers/hsi/clients/ssi_protocol.c
> index 9aeed98b87a1..504d00ec1ea7 100644
> --- a/drivers/hsi/clients/ssi_protocol.c
> +++ b/drivers/hsi/clients/ssi_protocol.c
> @@ -290,7 +290,7 @@ static void ssip_set_rxstate(struct ssi_protocol *ssi, unsigned int state)
>  		/* CMT speech workaround */
>  		if (atomic_read(&ssi->tx_usecnt))
>  			break;
> -		/* Otherwise fall through */
> +		/* Else, fall through */
>  	case RECEIVING:
>  		mod_timer(&ssi->keep_alive, jiffies +
>  						msecs_to_jiffies(SSIP_KATOUT));
> @@ -465,9 +465,10 @@ static void ssip_keep_alive(struct timer_list *t)
>  		case SEND_READY:
>  			if (atomic_read(&ssi->tx_usecnt) == 0)
>  				break;
> +			/* Fall through */
>  			/*
> -			 * Fall through. Workaround for cmt-speech
> -			 * in that case we relay on audio timers.
> +			 * Workaround for cmt-speech in that case
> +			 * we relay on audio timers.
>  			 */
>  		case SEND_IDLE:
>  			spin_unlock(&ssi->lock);
> -- 
> 2.22.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-07-30 20:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 22:45 [PATCH] HSI: ssi_protocol: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-07-30 16:58 ` Kees Cook
2019-07-30 20:15 ` Sebastian Reichel

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.