Commit 272e4f53 authored by Warner Losh's avatar Warner Losh
Browse files

cam: Fix wiring fence post error

If the last matching device entry partially matched in camperiphunit,
but then hit a continue case, we'd mistakenly think we had a match on
that entry. This lead to a number of problems downstream (usually a
belief that we had a duplicate wiring hint because unit = 0 is the
default). Fix this by using a for loop that does the assignment before
the loop termination test.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:
parent 82bfeeff
......@@ -611,8 +611,9 @@ camperiphunit(struct periph_driver *p_drv, path_id_t pathid,
unit = 0;
i = 0;
dname = periph_name;
while (resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0) {
wired = false;
for (wired = false; resource_find_dev(&i, dname, &dunit, NULL, NULL) == 0;
wired = false) {
if (resource_string_value(dname, dunit, "at", &strval) == 0) {
if (strcmp(strval, pathbuf) != 0)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment