diff mbox series

ath11k: fix fallthrough warnings

Message ID 1559754036-2358-1-git-send-email-msinada@codeaurora.org (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series ath11k: fix fallthrough warnings | expand

Commit Message

Muna Sinada June 5, 2019, 5 p.m. UTC
Marked expected switch case fall-through.

Fall through warnings were generated when running ath11k-check script
with --extra flag:

    drivers/net/wireless/ath/ath11k/core.c:741:14:
	warning: this statement may fall through Wimplicit-fallthrough=]
    drivers/net/wireless/ath/ath11k/dp.c:133:6:
	warning: this statement may fall through [-Wplicit-fallthrough=]

Signed-off-by: Muna Sinada <msinada@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/core.c | 1 +
 drivers/net/wireless/ath/ath11k/dp.c   | 1 +
 2 files changed, 2 insertions(+)

Comments

Kalle Valo June 6, 2019, 3:13 p.m. UTC | #1
Muna Sinada <msinada@codeaurora.org> writes:

> Marked expected switch case fall-through.
>
> Fall through warnings were generated when running ath11k-check script
> with --extra flag:
>
>     drivers/net/wireless/ath/ath11k/core.c:741:14:
> 	warning: this statement may fall through Wimplicit-fallthrough=]
>     drivers/net/wireless/ath/ath11k/dp.c:133:6:
> 	warning: this statement may fall through [-Wplicit-fallthrough=]
>
> Signed-off-by: Muna Sinada <msinada@codeaurora.org>

[...]

> --- a/drivers/net/wireless/ath/ath11k/dp.c
> +++ b/drivers/net/wireless/ath/ath11k/dp.c
> @@ -138,6 +138,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
>  			break;
>  		}
>  		/* follow through when ring_num >= 3 */
> +		/* fall through */

Duplicate comments saying the same thing, can't you merge those?
Muna Sinada June 6, 2019, 9:19 p.m. UTC | #2
On 2019-06-06 08:13, Kalle Valo wrote:
> Muna Sinada <msinada@codeaurora.org> writes:
> 
>> Marked expected switch case fall-through.
>> 
>> Fall through warnings were generated when running ath11k-check script
>> with --extra flag:
>> 
>>     drivers/net/wireless/ath/ath11k/core.c:741:14:
>> 	warning: this statement may fall through Wimplicit-fallthrough=]
>>     drivers/net/wireless/ath/ath11k/dp.c:133:6:
>> 	warning: this statement may fall through [-Wplicit-fallthrough=]
>> 
>> Signed-off-by: Muna Sinada <msinada@codeaurora.org>
> 
> [...]
> 
>> --- a/drivers/net/wireless/ath/ath11k/dp.c
>> +++ b/drivers/net/wireless/ath/ath11k/dp.c
>> @@ -138,6 +138,7 @@ int ath11k_dp_srng_setup(struct ath11k_base *ab, 
>> struct dp_srng *ring,
>>  			break;
>>  		}
>>  		/* follow through when ring_num >= 3 */
>> +		/* fall through */
> 
> Duplicate comments saying the same thing, can't you merge those?

ath11k_check did not recognize "fall through" in the first comment 
causing the initial fall through warning. It seems that fall through 
comment needs to be on a separate comment to avoid getting warning from 
ath11k_check. Should I get rid of first comment or leave things how they 
are now?

Muna
Kalle Valo June 7, 2019, 5:03 a.m. UTC | #3
msinada@codeaurora.org writes:

> On 2019-06-06 08:13, Kalle Valo wrote:
>> Muna Sinada <msinada@codeaurora.org> writes:
>>
>>> Marked expected switch case fall-through.
>>>
>>> Fall through warnings were generated when running ath11k-check script
>>> with --extra flag:
>>>
>>>     drivers/net/wireless/ath/ath11k/core.c:741:14:
>>> 	warning: this statement may fall through Wimplicit-fallthrough=]
>>>     drivers/net/wireless/ath/ath11k/dp.c:133:6:
>>> 	warning: this statement may fall through [-Wplicit-fallthrough=]
>>>
>>> Signed-off-by: Muna Sinada <msinada@codeaurora.org>
>>
>> [...]
>>
>>> --- a/drivers/net/wireless/ath/ath11k/dp.c
>>> +++ b/drivers/net/wireless/ath/ath11k/dp.c
>>> @@ -138,6 +138,7 @@ int ath11k_dp_srng_setup(struct ath11k_base
>>> *ab, struct dp_srng *ring,
>>>  			break;
>>>  		}
>>>  		/* follow through when ring_num >= 3 */
>>> +		/* fall through */
>>
>> Duplicate comments saying the same thing, can't you merge those?
>
> ath11k_check did not recognize "fall through" in the first comment
> causing the initial fall through warning. It seems that fall through
> comment needs to be on a separate comment to avoid getting warning
> from ath11k_check. Should I get rid of first comment or leave things
> how they are now?

Ah, I tested this myself now and indeed GCC does not regocnise '/* fall
through when ring_num >= 3 */' as a valid fallthrough comment even the
recommendation implied otherwise:

https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Oh well, so I guess we just need to have two comments even it's IMHO
ugly. Unless someone has other ideas?
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index e3e6b647888a..b5f710a7e915 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -739,6 +739,7 @@  static void ath11k_core_restart(struct work_struct *work)
 			break;
 		case ATH11K_STATE_RESTARTED:
 			ar->state = ATH11K_STATE_WEDGED;
+			/* fall through */
 		case ATH11K_STATE_WEDGED:
 			ath11k_warn(sc,
 				    "device is wedged, will not restart radio %d\n", i);
diff --git a/drivers/net/wireless/ath/ath11k/dp.c b/drivers/net/wireless/ath/ath11k/dp.c
index 0aec840fc360..be10e98b0bcd 100644
--- a/drivers/net/wireless/ath/ath11k/dp.c
+++ b/drivers/net/wireless/ath/ath11k/dp.c
@@ -138,6 +138,7 @@  int ath11k_dp_srng_setup(struct ath11k_base *ab, struct dp_srng *ring,
 			break;
 		}
 		/* follow through when ring_num >= 3 */
+		/* fall through */
 	case HAL_REO_EXCEPTION:
 	case HAL_REO_REINJECT:
 	case HAL_REO_CMD: