Re: [PATCH] wireless: remove unneeded break

From: Gustavo A. R. Silva
Date: Mon Oct 19 2020 - 12:58:54 EST




On 10/19/20 11:20, Joe Perches wrote:
> On Mon, 2020-10-19 at 10:54 -0500, Gustavo A. R. Silva wrote:
>> On 10/19/20 10:21, Joe Perches wrote:
>>> On Mon, 2020-10-19 at 17:14 +0200, Christian Lamparter wrote:
>>>> On 19/10/2020 17:05, trix@xxxxxxxxxx wrote:
>>>>> From: Tom Rix <trix@xxxxxxxxxx>
>>>>>
>>>>> A break is not needed if it is preceded by a return or goto
>>>>>
>>>>> Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
>>>>> diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c
> []
>>>>> @@ -870,7 +870,6 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
>>>>> } else {
>>>>> goto good_eeprom;
>>>>> }
>>>>> - break;
>>>> Won't the compiler (gcc) now complain about a missing fallthrough annotation?
>>
>> Clang would definitely complain about this.
>
> As far as I can tell, clang 10.0.0 doesn't complain.

Oh, yeah. I didn't see the other "goto err;" in the if clause above. Clang doesn't
complain because there is actually no chance of any implicit fall-through.

--
Gustavo