Page MenuHomeFreeBSD

Fix enum warning in ath_hal's ar9002
Needs ReviewPublic

Authored by dim on Jul 31 2024, 7:46 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Aug 14, 9:59 AM
Unknown Object (File)
Aug 6 2024, 10:43 PM
Subscribers
None

Details

Reviewers
adrian
imp
jhb
Summary

This fixes a clang 19 warning:

sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c:57:32: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_ANT_SETTING') [-Werror,-Wenum-compare]
   57 |             (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) {
      |              ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~

The ah_diversity field of struct ath_hal_5212 is of type HAL_BOOL,
not the enum type HAL_ANT_SETTING. In other code, ah_diversity is
set to AH_TRUE whenever the related field ah_antControl is set to
HAL_ANT_VARIABLE.

It is not entirely clear to me what the intended statement is here: the
test as it is written now compares the enum value 0 to ah_diversity,
so in effect it enables the following block whenever ah_diversity is
AH_TRUE. Write it like that, to avoid the compiler warning.

MFC after: 3 days

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 58904
Build 55791: arc lint + arc unit

Event Timeline

dim requested review of this revision.Jul 31 2024, 7:46 PM
dim created this revision.

oh crap, we should change ah_diversity to be the right type. HAL_ANT_VARIABLE is different!

Lemme look at this and see if i can clean it up a bunch. Stay tuned.