On 2021-11-25 3:55 a.m., Otto Moerbeek wrote:
+       parent = OF_parent(handle);

I think the OF_parent call can go inside the !strcmp(buf, "block") block.


I worried that the following re-assignment of the handle would cause problems, so I chose an order of operations and placed the parent call before this re-assignment. The reason for my concern is based on not knowing the proper distinction between OF_finddevice and OF_open in the boot prom itself (they are both kind of opaque to me and just send bits for interpretation into the boot prom).

if ((handle = OF_open(fname)) == -1) {
        DNPRINTF(BOOT_D_OFDEV, "devopen: open of %s failed\n", fname);
        return ENXIO;
}

It's possible that there is no meaningful distinction between when handle is re-assigned midway through the function, in which case you are correct it could absolutely be moved later in the function call. Notably there is quite a bit of variable re-use and re-purposing in the devopen function so I chose the place I thought would be safest.

--
Ted Bullock <[email protected]>

Reply via email to