summaryrefslogtreecommitdiff
path: root/drivers/core/uclass.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-08-30 22:55:16 (GMT)
committerSimon Glass <sjg@chromium.org>2015-09-03 03:28:23 (GMT)
commit3346c87625b8a736af5636a0bd1be89f781eb5f2 (patch)
tree7fcd658cc520499f136add1e46643152618e9bf6 /drivers/core/uclass.c
parente3563f2ec768fb989149362ca0c6ca4a27513924 (diff)
downloadu-boot-3346c87625b8a736af5636a0bd1be89f781eb5f2.tar.xz
dm: Improve handling of a missing uclass
When a uclass definition is missing, no drivers in that uclass can operate. This can happen if a board has a strange collection of options (e.g. the driver is enabled but the uclass is not). Unfortunately this is very confusing at present. Starting up driver model results in a -ENOENT error, which is pretty generic. Quite a big of digging is needed to get to the root cause. To help with this, change the error to a very strange one with no other users in U-Boot. Also add a debug message. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/uclass.c')
-rw-r--r--drivers/core/uclass.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index f63ff59..e800c28 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -58,7 +58,12 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
if (!uc_drv) {
debug("Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n",
id);
- return -ENOENT;
+ /*
+ * Use a strange error to make this case easier to find. When
+ * a uclass is not available it can prevent driver model from
+ * starting up and this failure is otherwise hard to debug.
+ */
+ return -EPFNOSUPPORT;
}
uc = calloc(1, sizeof(*uc));
if (!uc)