Don't try to compute I/O for empty sub buses.
authorStefan Reinauer <reinauer@chromium.org>
Wed, 11 May 2011 22:57:07 +0000 (15:57 -0700)
committerStefan Reinauer <stefan.reinauer@coreboot.org>
Fri, 9 Mar 2012 19:32:58 +0000 (20:32 +0100)
I am not sure if the sub bus being 0 is a problem, or if the assumption
there has to be at least one non empty link is just wrong. It certainly
does not hurt to add a small consistency check in either case.

Change-Id: I098446deef96a8baae26a7ca1ddd96e626a06dc5
Signed-off-by: Stefan Reinauer <reinauer@google.com>
Reviewed-on: http://review.coreboot.org/693
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
src/devices/device_util.c

index 9081a36ea20628ae56b1bf52117d15043d052a94..84fb11505c26def8f937c1bf533ef7ea962a9d48 100644 (file)
@@ -583,6 +583,8 @@ void search_bus_resources(struct bus *bus, unsigned long type_mask,
                                        if (subbus->link_num
                                        == IOINDEX_SUBTRACTIVE_LINK(res->index))
                                                break;
+                               if (!subbus) /* Why can subbus be NULL?  */
+                                       break;
                                search_bus_resources(subbus, type_mask, type,
                                                     search, gp);
                                continue;