All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Cc: Marek Vasut <marek.vasut+renesas@gmail.com>,
	Marcel Ziswiler <marcel.ziswiler@toradex.com>,
	Simon Glass <sjg@chromium.org>
Subject: [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str()
Date: Sun,  4 Jul 2021 21:32:05 +0200	[thread overview]
Message-ID: <20210704193205.84356-2-marek.vasut+renesas@gmail.com> (raw)
In-Reply-To: <20210704193205.84356-1-marek.vasut+renesas@gmail.com>

The sysinfo_get_str() implementation checks whether the sysinfo was even
detected. In U-Boot proper, sysinfo_detect() is not called anywhere but
on one specific board. Call sysinfo_detect() before sysinfo_get_str() to
make sure the sysinfo is detected and sysinfo_get_str() returns valid
value instead of -EPERM.

Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Cc: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Cc: Simon Glass <sjg@chromium.org>
---
 common/board_info.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/board_info.c b/common/board_info.c
index 89a29c322c..e0f2d93922 100644
--- a/common/board_info.c
+++ b/common/board_info.c
@@ -32,10 +32,14 @@ int __weak show_board_info(void)
 		if (IS_ENABLED(CONFIG_SYSINFO)) {
 			/* This might provide more detail */
 			ret = sysinfo_get(&dev);
-			if (!ret)
-				ret = sysinfo_get_str(dev,
+			if (!ret) {
+				ret = sysinfo_detect(dev);
+				if (!ret) {
+					ret = sysinfo_get_str(dev,
 						      SYSINFO_ID_BOARD_MODEL,
 						      sizeof(str), str);
+				}
+			}
 		}
 
 		/* Fail back to the main 'model' if available */
-- 
2.30.2


  reply	other threads:[~2021-07-04 19:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 19:32 [PATCH 1/2] board-info: Use sysinfo_get() Marek Vasut
2021-07-04 19:32 ` Marek Vasut [this message]
2021-07-05 15:29   ` [PATCH 2/2] board-info: Call sysinfo_detect() before sysinfo_get_str() Simon Glass
2021-07-14 20:52   ` Tom Rini
2021-07-05 15:29 ` [PATCH 1/2] board-info: Use sysinfo_get() Simon Glass
2021-07-14 20:52 ` 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=20210704193205.84356-2-marek.vasut+renesas@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=marcel.ziswiler@toradex.com \
    --cc=marek.vasut+renesas@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /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.