cifs: Convert to use the fallthrough macro
Subsystems (2)
PATCH 1/1 cifs: Convert to use the fallthrough macro
From: Miaohe Lin <[email protected]>
Convert the uses of fallthrough comments to fallthrough macro.
--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +2 -2
@@ -3913,7 +3913,7 @@ smb2_readv_callback(struct mid_q_entry *mid)case MID_RESPONSE_MALFORMED : credits.value =le16_to_cpu (shdr->CreditRequest); credits.instance = server->reconnect_instance; -/* fall through */ + fallthrough;default : rdata->result = -EIO ; }
@@ -4146,7 +4146,7 @@ smb2_writev_callback(struct mid_q_entry *mid)case MID_RESPONSE_MALFORMED : credits.value =le16_to_cpu (rsp->sync_hdr.CreditRequest); credits.instance = server->reconnect_instance; -/* fall through */ + fallthrough;default : wdata->result = -EIO ;break ;
Signature · 1 line
2.19.1
Is this conversion from "/* Fallthrough */" to the preferred (?)
"fallthrough;" documented anywhere?
All I see is a few fs changesets like:
commit c730ae0c6bb3125ccb776fb2ab6abbdff500c02c
Author: Marcos Paulo de Souza <[email protected]> Date: Tue Jun 16 15:54:29 2020 -0300
btrfs: convert comments to fallthrough annotations
Convert fall through comments to the pseudo-keyword which is now the preferred way.
And the vast majority of places (33 vs. 4) use "/* Fallthrough */ in the fs directory
Quoted 36 lines · linmiaohe
From: Miaohe Lin <[email protected]>
Convert the uses of fallthrough comments to fallthrough macro.
Signed-off-by Hongxiang Lou <[email protected]>Signed-off-by Miaohe Lin <[email protected]>--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/cifs/smb2pdu.c +2
-3@@ -3913,7 +3913,7 @@ smb2_readv_callback(struct mid_q_entry *mid)case MID_RESPONSE_MALFORMED : credits.value =le16_to_cpu (shdr->CreditRequest); credits.instance = server->reconnect_instance; -/* fall through */ + fallthrough;default : rdata->result = -EIO ; }@@ -4146,7 +4146,7 @@ smb2_writev_callback(struct mid_q_entry *mid)case MID_RESPONSE_MALFORMED : credits.value =le16_to_cpu (rsp->sync_hdr.CreditRequest); credits.instance = server->reconnect_instance; -/* fall through */ + fallthrough;default : wdata->result = -EIO ;break ; --2.19.1
Signature · 3 lines
Thanks, Steve
Quoted 2 lines · Steve French
Is this conversion from "/* Fallthrough */" to the preferred (?)
"fallthrough;" documented anywhere?
Documentation/process/deprecated.rst
As there have been a long list of flaws `due to missing "break" statements
<https://cwe.mitre.org/data/definitions/484.html>_, we no longer allow implicit fall-through. In order to identify intentional fall-through cases, we have adopted a pseudo-keyword macro "fallthrough" which expands to gcc's extension __attribute__((__fallthrough__))
<https://gcc.gnu.org/onlinedocs/gcc/Statement-Attributes.html>`_.
Steve French
Appliedmerged into cifs-2.6.git for-next
(but note that most places in fs directory other than cifs and btrfs have not been updated), and I noticed another 8 places in fs/cifs that you didn't change in your patch (ie change from the older way of
indicating fallthrough /* Fallthrough */ as a comment to the newer
fallthrough macro.
Quoted 36 lines · linmiaohe
From: Miaohe Lin <[email protected]>
Convert the uses of fallthrough comments to fallthrough macro.
Signed-off-by Hongxiang Lou <[email protected]>Signed-off-by Miaohe Lin <[email protected]>--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)fs/cifs/smb2pdu.c +2
-3@@ -3913,7 +3913,7 @@ smb2_readv_callback(struct mid_q_entry *mid)case MID_RESPONSE_MALFORMED : credits.value =le16_to_cpu (shdr->CreditRequest); credits.instance = server->reconnect_instance; -/* fall through */ + fallthrough;default : rdata->result = -EIO ; }@@ -4146,7 +4146,7 @@ smb2_writev_callback(struct mid_q_entry *mid)case MID_RESPONSE_MALFORMED : credits.value =le16_to_cpu (rsp->sync_hdr.CreditRequest); credits.instance = server->reconnect_instance; -/* fall through */ + fallthrough;default : wdata->result = -EIO ;break ; --2.19.1
Signature · 3 lines
Thanks, Steve