All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Stephan <jstephan@baylibre.com>
To: u-boot@lists.u-boot-project.org
Cc: GSS_MTK_Uboot_upstream <GSS_MTK_Uboot_upstream@mediatek.com>,
	 Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	 Julien Stephan <jstephan@baylibre.com>,
	 "Markus Schneider-Pargmann (TI)" <msp@baylibre.com>,
	dlechner@baylibre.com
Subject: [PATCH v2 3/3] initcall: initcall_evt: display error code on error
Date: Mon, 24 Aug 2026 10:44:18 +0200	[thread overview]
Message-ID: <20260824-improve-logging-on-missing-uclass-v2-3-4bee2cdff72b@baylibre.com> (raw)
In-Reply-To: <20260824-improve-logging-on-missing-uclass-v2-0-4bee2cdff72b@baylibre.com>

Currently when an initcall/initcall_evt fails the error code is not
displayed. Display it, along with the corresponding error string if
ERRNO_STR is enabled.

Signed-off-by: Julien Stephan <jstephan@baylibre.com>
---
 include/initcall.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/initcall.h b/include/initcall.h
index 220a55ad84d..12e5235f506 100644
--- a/include/initcall.h
+++ b/include/initcall.h
@@ -14,18 +14,20 @@ _Static_assert(EVT_COUNT < 256, "Can only support 256 event types with 8 bits");
 
 #define INITCALL(_call) \
 	do { \
-		if (_call()) { \
-			printf("%s(): initcall %s() failed\n", __func__, \
-			       #_call); \
+		int _ret = _call(); \
+		if (_ret) { \
+			printf("%s(): initcall %s() failed (err=%dE)\n", \
+			       __func__, #_call, _ret); \
 			hang(); \
 		} \
 	} while (0)
 
 #define INITCALL_EVT(_evt) \
 	do { \
-		if (event_notify_null(_evt)) { \
-			printf("%s(): event %d/%s failed\n", __func__, _evt, \
-			       event_type_name(_evt)) ; \
+		int _ret = event_notify_null(_evt); \
+		if (_ret) { \
+			printf("%s(): event %d/%s failed (err=%dE)\n", \
+			       __func__, _evt, event_type_name(_evt), _ret); \
 			hang(); \
 		} \
 	} while (0)

-- 
2.54.0


  parent reply	other threads:[~2026-08-24  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24  8:44 [PATCH v2 0/3] Improve logging on missing uclass Julien Stephan
2026-08-24  8:44 ` [PATCH v2 1/3] dm: add dm_err() and a driver model log verbosity choice Julien Stephan
2026-08-24  8:44 ` [PATCH v2 2/3] dm: uclass: use dm_err() for a missing uclass Julien Stephan
2026-08-24  8:44 ` Julien Stephan [this message]
2026-09-03 22:56 ` [PATCH v2 0/3] Improve logging on " Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260824-improve-logging-on-missing-uclass-v2-3-4bee2cdff72b@baylibre.com \
    --to=jstephan@baylibre.com \
    --cc=GSS_MTK_Uboot_upstream@mediatek.com \
    --cc=dlechner@baylibre.com \
    --cc=msp@baylibre.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.u-boot-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.