Page MenuHomeFreeBSD

Fix clang 15 warning in cxgbe
ClosedPublic

Authored by dim on Jul 16 2022, 7:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 20 2023, 7:31 AM
Unknown Object (File)
Dec 12 2023, 8:15 AM
Unknown Object (File)
Aug 10 2023, 7:02 PM
Unknown Object (File)
Jul 4 2023, 5:47 AM
Unknown Object (File)
Jun 21 2023, 1:58 PM
Unknown Object (File)
Jun 15 2023, 3:14 PM
Unknown Object (File)
Apr 8 2023, 4:48 PM
Unknown Object (File)
Mar 3 2023, 10:42 AM
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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.