[PATCH 1/2] dm: improve logging for missing uclass

Julien Stephan <[email protected]> Thu, 06 Aug 2026 15:05:19 +0200
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <20260806-improve-logging-on-missing-uclass-v1-1-d477f0054f48__23195.6973484316$1786021542$gmane$org@baylibre.com>
When a uclass definition is missing for an enabled driver, the board
cannot boot, and without any extra debug option enabled the following
error is displayed:

  initcall_run_r(): initcall initr_dm() failed ### ERROR ### Please
  RESET the board ###

There is a debug message using dm_warn(), which is not displayed by
default.  Since this is a fatal error preventing the board from booting,
the log level should be at least ERROR.

Signed-off-by: Julien Stephan <[email protected]>
---
 drivers/core/uclass.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 5365ac68f9e..be0159155f0 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -60,8 +60,9 @@ static int uclass_add(enum uclass_id id, struct uclass **ucp)
 	*ucp = NULL;
 	uc_drv = lists_uclass_lookup(id);
 	if (!uc_drv) {
-		dm_warn("Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n",
-			id);
+		log(LOGC_DM, LOGL_ERR,
+		    "Cannot find uclass for id %d: please add the UCLASS_DRIVER() declaration for this UCLASS_... id\n",
+		    id);
 		/*
 		 * Use a strange error to make this case easier to find. When
 		 * a uclass is not available it can prevent driver model from

-- 
2.54.0