[PATCH v2 2/3] dm: uclass: use dm_err() for a missing uclass

Julien Stephan <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <20260824-improve-logging-on-missing-uclass-v2-2-4bee2cdff72b@baylibre.com>
When a uclass definition is missing for an enabled driver, the board
cannot boot, and without any extra debug option enabled the only output
is an obscure message with no hint about the root cause:

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

The existing message used dm_warn(), which is not shown by default. Since
this is a fatal error preventing the board from booting, use the new
dm_err() helper so it is emitted at ERROR level and visible by default.
Shorten the message as well to limit the code size overhead.

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

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 5365ac68f9e..83a67dfb4de 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -60,8 +60,7 @@ 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);
+		dm_err("uclass %d: no UCLASS_DRIVER()\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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.