Page MenuHomeFreeBSD

cam: Initialize wired to false
ClosedPublic

Authored by imp on Nov 29 2021, 2:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 12, 1:44 PM
Unknown Object (File)
Sun, Mar 31, 3:05 PM
Unknown Object (File)
Thu, Mar 28, 1:02 PM
Unknown Object (File)
Jan 12 2024, 11:32 PM
Unknown Object (File)
Dec 23 2023, 3:51 AM
Unknown Object (File)
Nov 20 2023, 6:57 PM
Unknown Object (File)
Sep 5 2023, 2:23 AM
Unknown Object (File)
May 28 2023, 2:45 AM
Subscribers

Details

Reviewers
mjg
Group Reviewers
cam
Commits
rG3846662dab2c: cam: Initialize wired to false
Summary

As part of converting the code to a while loop, the unconditional
initialization of wired to false was lost.

Sponsored by: Netflix

Diff Detail

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

Event Timeline

imp requested review of this revision.Nov 29 2021, 2:03 PM
jrtc27 added inline comments.
sys/cam/cam_periph.c
615

The control flow here is also a bit weird, would make more sense to me as:

while (resource_find_dev(...) == 0 && !wired) {
    if (...) {
        wired = true;
    }
    ...
    if (...) {
        wired = true;
    }
}
if (wired)
    unit = dunit;
sys/cam/cam_periph.c
615

Or probably !wired && resource_find_dev(...) == 0 so it doesn't mess with dunit after wired becomes true

sys/cam/cam_periph.c
615

Yea, maybe true. Also true that it likely is more likely to introduce a new bug. I'll look at making that structural change in a separate commit that i can take more time to validate so there aren't other hidden dragons... like the fact that we hit continue and reset wired to false which would
break your suggested reordering. Otherwise we would just do 'break' at that point.

sys/cam/cam_periph.c
615

I see, initially read it as iterating over property names and thus only one would ever be true... but indeed that's not what it does. Agreed it's not for this diff.

As noted in the mail I don't know what this code is supposed to be doing, so I'm not going to review anything.

However, setting 'wired = false' upfront restores the previously seen behavior and fixes the immediate regression, so I would say this should be committed and any other tinkering should come in later.

This revision was not accepted when it landed; it landed in state Needs Review.Nov 30 2021, 9:43 PM
This revision was automatically updated to reflect the committed changes.