All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFC: st21nfca: Fix a couple of fall-through warnings
@ 2019-02-12 17:39 Gustavo A. R. Silva
  2019-03-20 19:20 ` Gustavo A. R. Silva
  2019-04-09 16:30 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-02-12 17:39 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-wireless, linux-kernel, Gustavo A. R. Silva, Kees Cook

In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.

This patch fixes the following warnings by adding a missing break
and a fall-through annotation:

drivers/nfc/st21nfca/dep.c: In function ‘st21nfca_tm_event_send_data’:
drivers/nfc/st21nfca/dep.c:391:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
   switch (cmd1) {
   ^~~~~~
drivers/nfc/st21nfca/dep.c:404:2: note: here
  default:
  ^~~~~~~
In file included from ./include/linux/kernel.h:15,
                 from ./include/linux/skbuff.h:17,
                 from ./include/net/nfc/hci.h:21,
                 from drivers/nfc/st21nfca/dep.c:17:
drivers/nfc/st21nfca/dep.c: In function ‘st21nfca_im_recv_dep_res_cb’:
./include/linux/printk.h:303:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/nfc/st21nfca/dep.c:622:4: note: in expansion of macro ‘pr_err’
    pr_err("Received a ACK/NACK PDU\n");
    ^~~~~~
drivers/nfc/st21nfca/dep.c:623:3: note: here
   case ST21NFCA_NFC_DEP_PFB_I_PDU:
   ^~~~

Warning level 3 was used: -Wimplicit-fallthrough=3

This patch is part of the ongoing efforts to enable
-Wimplicit-fallthrough.

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
 drivers/nfc/st21nfca/dep.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nfc/st21nfca/dep.c b/drivers/nfc/st21nfca/dep.c
index 3420c5104c94..60f013063f80 100644
--- a/drivers/nfc/st21nfca/dep.c
+++ b/drivers/nfc/st21nfca/dep.c
@@ -401,6 +401,7 @@ static int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev,
 		default:
 			return 1;
 		}
+		break;
 	default:
 		return 1;
 	}
@@ -620,6 +621,7 @@ static void st21nfca_im_recv_dep_res_cb(void *context, struct sk_buff *skb,
 		switch (ST21NFCA_NFC_DEP_PFB_TYPE(dep_res->pfb)) {
 		case ST21NFCA_NFC_DEP_PFB_ACK_NACK_PDU:
 			pr_err("Received a ACK/NACK PDU\n");
+			/* fall through */
 		case ST21NFCA_NFC_DEP_PFB_I_PDU:
 			info->dep_info.curr_nfc_dep_pni =
 			    ST21NFCA_NFC_DEP_PFB_PNI(dep_res->pfb + 1);
-- 
2.20.1


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

* Re: [PATCH] NFC: st21nfca: Fix a couple of fall-through warnings
  2019-02-12 17:39 [PATCH] NFC: st21nfca: Fix a couple of fall-through warnings Gustavo A. R. Silva
@ 2019-03-20 19:20 ` Gustavo A. R. Silva
  2019-04-09 16:30 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Gustavo A. R. Silva @ 2019-03-20 19:20 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: linux-wireless, linux-kernel, Kees Cook

Hi all,

If no one cares, I'll add this to my tree for 5.2

Thanks
--
Gustavo

On 2/12/19 11:39 AM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
> 
> This patch fixes the following warnings by adding a missing break
> and a fall-through annotation:
> 
> drivers/nfc/st21nfca/dep.c: In function ‘st21nfca_tm_event_send_data’:
> drivers/nfc/st21nfca/dep.c:391:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    switch (cmd1) {
>    ^~~~~~
> drivers/nfc/st21nfca/dep.c:404:2: note: here
>   default:
>   ^~~~~~~
> In file included from ./include/linux/kernel.h:15,
>                  from ./include/linux/skbuff.h:17,
>                  from ./include/net/nfc/hci.h:21,
>                  from drivers/nfc/st21nfca/dep.c:17:
> drivers/nfc/st21nfca/dep.c: In function ‘st21nfca_im_recv_dep_res_cb’:
> ./include/linux/printk.h:303:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/nfc/st21nfca/dep.c:622:4: note: in expansion of macro ‘pr_err’
>     pr_err("Received a ACK/NACK PDU\n");
>     ^~~~~~
> drivers/nfc/st21nfca/dep.c:623:3: note: here
>    case ST21NFCA_NFC_DEP_PFB_I_PDU:
>    ^~~~
> 
> Warning level 3 was used: -Wimplicit-fallthrough=3
> 
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
> 
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
>  drivers/nfc/st21nfca/dep.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/nfc/st21nfca/dep.c b/drivers/nfc/st21nfca/dep.c
> index 3420c5104c94..60f013063f80 100644
> --- a/drivers/nfc/st21nfca/dep.c
> +++ b/drivers/nfc/st21nfca/dep.c
> @@ -401,6 +401,7 @@ static int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev,
>  		default:
>  			return 1;
>  		}
> +		break;
>  	default:
>  		return 1;
>  	}
> @@ -620,6 +621,7 @@ static void st21nfca_im_recv_dep_res_cb(void *context, struct sk_buff *skb,
>  		switch (ST21NFCA_NFC_DEP_PFB_TYPE(dep_res->pfb)) {
>  		case ST21NFCA_NFC_DEP_PFB_ACK_NACK_PDU:
>  			pr_err("Received a ACK/NACK PDU\n");
> +			/* fall through */
>  		case ST21NFCA_NFC_DEP_PFB_I_PDU:
>  			info->dep_info.curr_nfc_dep_pni =
>  			    ST21NFCA_NFC_DEP_PFB_PNI(dep_res->pfb + 1);
> 

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

* Re: [PATCH] NFC: st21nfca: Fix a couple of fall-through warnings
  2019-02-12 17:39 [PATCH] NFC: st21nfca: Fix a couple of fall-through warnings Gustavo A. R. Silva
  2019-03-20 19:20 ` Gustavo A. R. Silva
@ 2019-04-09 16:30 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2019-04-09 16:30 UTC (permalink / raw)
  To: Gustavo A. R. Silva; +Cc: Samuel Ortiz, linux-wireless, LKML

On Tue, Feb 12, 2019 at 9:39 AM Gustavo A. R. Silva
<gustavo@embeddedor.com> wrote:
>
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings by adding a missing break
> and a fall-through annotation:
>
> drivers/nfc/st21nfca/dep.c: In function ‘st21nfca_tm_event_send_data’:
> drivers/nfc/st21nfca/dep.c:391:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
>    switch (cmd1) {
>    ^~~~~~
> drivers/nfc/st21nfca/dep.c:404:2: note: here
>   default:
>   ^~~~~~~
> In file included from ./include/linux/kernel.h:15,
>                  from ./include/linux/skbuff.h:17,
>                  from ./include/net/nfc/hci.h:21,
>                  from drivers/nfc/st21nfca/dep.c:17:
> drivers/nfc/st21nfca/dep.c: In function ‘st21nfca_im_recv_dep_res_cb’:
> ./include/linux/printk.h:303:2: warning: this statement may fall through [-Wimplicit-fallthrough=]
>   printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/nfc/st21nfca/dep.c:622:4: note: in expansion of macro ‘pr_err’
>     pr_err("Received a ACK/NACK PDU\n");
>     ^~~~~~
> drivers/nfc/st21nfca/dep.c:623:3: note: here
>    case ST21NFCA_NFC_DEP_PFB_I_PDU:
>    ^~~~
>
> Warning level 3 was used: -Wimplicit-fallthrough=3
>
> This patch is part of the ongoing efforts to enable
> -Wimplicit-fallthrough.
>
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>

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

-- 
Kees Cook

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

end of thread, other threads:[~2019-04-09 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-12 17:39 [PATCH] NFC: st21nfca: Fix a couple of fall-through warnings Gustavo A. R. Silva
2019-03-20 19:20 ` Gustavo A. R. Silva
2019-04-09 16:30 ` Kees Cook

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.