Page MenuHomeFreeBSD

Fix clang 15 warning in cxgbe
ClosedPublic

Authored by dim on Jul 16 2022, 7:20 PM.
Tags
None
Referenced Files
F96502824: D35834.diff
Wed, Sep 25, 6:39 AM
F96355148: D35834.diff
Tue, Sep 24, 4:40 PM
Unknown Object (File)
Tue, Sep 24, 1:49 AM
Unknown Object (File)
Sat, Sep 21, 7:11 PM
Unknown Object (File)
Fri, Sep 20, 4:22 PM
Unknown Object (File)
Fri, Sep 20, 7:12 AM
Unknown Object (File)
Tue, Sep 17, 1:36 PM
Unknown Object (File)
Sat, Sep 7, 12:13 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
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.