On Tue, 27 Jun 2017 18:11:16 +0200
Gaetan Rivet <[email protected]> wrote:
> + int start_found = !!(start == NULL);
> +
> + FOREACH_DEVICE_ON_PCIBUS(dev) {
> + if (!start_found) {
> + if (&dev->device == start)
> + start_found = 1;
> + continue;
> + }
> + if (cmp(&dev->device, data) == 0)
> + return &dev->device;
> + }
> + return NULL;
> +}
> +
Why is start_found not a boolean?
Do you really need start_found at all? Why not just reuse existing
pointer?
FOREACH_DEVICE_ON_PCIBUS(dev) {
if (start) {
if (&dev->device == start)
start = NULL
continue;
}
if (cmp(&dev->device, data) == 0)
return &dev->device;
}
return NULL;
}