Page MenuHomeFreeBSD

Fix clang 15 warning in cxgbe
ClosedPublic

Authored by dim on Jul 16 2022, 7:20 PM.
Tags
None
Referenced Files
F108622715: D35834.diff
Sun, Jan 26, 11:02 PM
Unknown Object (File)
Sat, Jan 18, 3:00 AM
Unknown Object (File)
Nov 21 2024, 9:21 AM
Unknown Object (File)
Nov 19 2024, 3:34 AM
Unknown Object (File)
Nov 12 2024, 1:47 PM
Unknown Object (File)
Oct 19 2024, 9:58 PM
Unknown Object (File)
Oct 19 2024, 2:07 PM
Unknown Object (File)
Oct 19 2024, 2:07 PM
Subscribers

Details

Summary

Clang 15 warns:

sys/dev/cxgbe/cudbg/cudbg_lib.c:2949:6: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
        int i = 0;
            ^

Apparently 'i' was meant as the current retry counter, but '1' was used
in the while loop comparison instead, making the loop potentially
infinite, if 'busy' never gets reset.

MFC after: 3 days

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46459
Build 43348: arc lint + arc unit

Event Timeline

dim requested review of this revision.Jul 16 2022, 7:20 PM
sys/dev/cxgbe/cudbg/cudbg_lib.c
2953

Should there be a bitwise or boolean and here?

sys/dev/cxgbe/cudbg/cudbg_lib.c
2953

Oh that's a good one. Short-circuit evaluation won't matter in this case, so it should be && instead. I'd also think that busy should be volatile, but it could be that t4_read_reg() takes care of that?

sys/dev/cxgbe/cudbg/cudbg_lib.c
2953

Yes, the t4_reg_read will take care of that.

Please commit with boolean &&.

This revision is now accepted and ready to land.Jul 16 2022, 11:51 PM
This revision was automatically updated to reflect the committed changes.