Skip to contentSkip to conversation

-Wconstant-conversion in drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c

DISCUSSION Nathan Chancellor 2 participants 3 messages Sep 16 – Oct 5 1 message not in the archive Broadcom BRCM80211 IEEE802.11 wireless drivers

lore
Share & tools
lore
#0 lore raw

Hi Arend,

After [1] landed in clang main, I am seeing the following warning (turned error with CONFIG_WERROR=y / W=e):

drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:224:18: error: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to -128 [-Werror,-Wconstant-conversion]

    224 |         {0, 0, 0, 0, 0, 128},
        |         ~               ^~~

As far as I can tell, this has been present since the original commit that added brcm80211 to the tree

a9533e7ea3c4 ("Staging: Add initial release of brcm80211 - Broadcom 802.11n wireless LAN driver.")

based on my reading of drivers/staging/brcm80211/phy/wlc_phy_n.c. Should this final value be changed to -128 or should there be some other fix?

[1]: https://github.com/llvm/llvm-project/commit/a5ef934a8d295dc03be3960f2b3744ec2e53238e

Signature · 2 lines
Cheers,
Nathan

A message that is not in the archive (sent off-list or not yet received): [email protected]

maintainer
#2 lore raw

resending...

Op 16 september 2026 08:45:59 schreef Nathan Chancellor <[email protected]>:

Quoted 9 lines

Hi Arend,

After [1] landed in clang main, I am seeing the following warning (turned error with CONFIG_WERROR=y / W=e):

drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:224:18: error: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to -128 [-Werror,-Wconstant-conversion]
224 | {0, 0, 0, 0, 0, 128},
| ~ ^~~

Quoted 7 lines

As far as I can tell, this has been present since the original commit that added brcm80211 to the tree

a9533e7ea3c4 ("Staging: Add initial release of brcm80211 - Broadcom 802.11n wireless LAN driver.")

based on my reading of drivers/staging/brcm80211/phy/wlc_phy_n.c. Should this final value be changed to -128 or should there be some other fix?

To be honest I don't know. If I looked at the proprietary driver code that table entry is still there with exactly the same values. So to be type correct while preserving the same value it should be -128. However, looking at the table entry struct it is an index so that sounds odd.

Regards,
Arend

#3 lore raw
Quoted 19 lines · Arend van Spriel

Op 16 september 2026 08:45:59 schreef Nathan Chancellor <[email protected]>:

Quoted 17 lines

Hi Arend,

After [1] landed in clang main, I am seeing the following warning (turned error with CONFIG_WERROR=y / W=e):

drivers/net/wireless/broadcom/brcm80211/brcmsmac/phy/phy_n.c:224:18:
error: implicit conversion from 'int' to 's8' (aka 'signed char') changes value from 128 to -128 [-Werror,-Wconstant-conversion]
224 | {0, 0, 0, 0, 0, 128},
| ~ ^~~

As far as I can tell, this has been present since the original commit that added brcm80211 to the tree

a9533e7ea3c4 ("Staging: Add initial release of brcm80211 - Broadcom 802.11n wireless LAN driver.")

Quoted 7 lines
Quoted 2 lines

based on my reading of drivers/staging/brcm80211/phy/wlc_phy_n.c. Should this final value be changed to -128 or should there be some other fix?

To be honest I don't know. If I looked at the proprietary driver code that table entry is still there with exactly the same values. So to be type correct while preserving the same value it should be -128. However, looking at the table entry struct it is an index so that sounds odd.

Thanks a lot for the input! I sent a patch to change it to -128 to clear up the warning since it will be the same bit representation and presumably things are working properly with that:

https://lore.kernel.org/20260916064454.GA3635613@ax162/

Signature · 2 lines
Cheers,
Nathan