Process negative return values from intf->probe()
Some platforms use probe methods that may encounter errors, such as
missing device tree files.
BUG=none
BRANCH=none
TEST=peach no longer detected if /proc/device-tree/model not found
(probe method returns -1)
Change-Id: I8dbe4f6a1e0d382afdf962476cc24c05b1cdf3d5
Signed-off-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/219576
Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
diff --git a/core/platform.c b/core/platform.c
index 6c247a8..cdfb108 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -85,11 +85,19 @@
}
/* auto-detect */
- if (intf->probe && intf->probe(intf)) {
- lprintf(LOG_DEBUG, "Platform %s found (via "
+ if (intf->probe) {
+ int rc = intf->probe(intf);
+
+ if (rc < 0) {
+ lprintf(LOG_DEBUG, "Error encountered when "
+ "probing %s\n", intf->name);
+ continue;
+ } else if (rc > 0) {
+ lprintf(LOG_DEBUG, "Platform %s found (via "
"probing)\n", intf->name);
- intf_found = 1;
- break;
+ intf_found = 1;
+ break;
+ }
}
}