]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board-info: Call sysinfo_detect() before sysinfo_get_str()
authorMarek Vasut <marek.vasut@gmail.com>
Sun, 4 Jul 2021 19:32:05 +0000 (21:32 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 14 Jul 2021 20:48:00 +0000 (16:48 -0400)
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>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/board_info.c

index 89a29c322ce75f0f637a34457dcbe65c961dc939..e0f2d9392204435558f464e93e897916ae84406b 100644 (file)
@@ -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 */