[PATCH] spl: remove redundant prints in boot_from_devices
Anshul Dalal
anshuld at ti.com
Fri Oct 31 08:46:26 CET 2025
The null check for loader in boot_from_devices was moved earlier in the
code path by the commit ae409a84e7bff ("spl: NULL check variable before
dereference"), therefore the subsequent null checks for loader are not
necessary.
This patch removes those checks and refactors the prints to be more
useful in case of errors.
Signed-off-by: Anshul Dalal <anshuld at ti.com>
---
common/spl/spl.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 64313cb8dfe1a401078882564b69890480c9894d..39ba5a9d75d3f407d037f19458f5dad77e50eaf0 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -642,26 +642,26 @@ static int boot_from_devices(struct spl_image_info *spl_image,
if (loader && bootdev != loader->boot_device)
continue;
if (!CONFIG_IS_ENABLED(SILENT_CONSOLE)) {
- if (loader)
- printf("Trying to boot from %s\n",
- spl_loader_name(loader));
- else if (CONFIG_IS_ENABLED(SHOW_ERRORS)) {
- printf(PHASE_PROMPT
- "Unsupported Boot Device %d\n",
- bootdev);
- } else {
- puts(PHASE_PROMPT
- "Unsupported Boot Device!\n");
- }
+ printf("Trying to boot from %s\n",
+ spl_loader_name(loader));
}
- if (loader) {
- ret = spl_load_image(spl_image, loader);
- if (!ret) {
- spl_image->boot_device = bootdev;
- return 0;
- }
- printf("Error: %d\n", ret);
+
+ ret = spl_load_image(spl_image, loader);
+ if (!ret) {
+ spl_image->boot_device = bootdev;
+ return 0;
}
+ printf("Error: %d\n", ret);
+ }
+
+ if (!CONFIG_IS_ENABLED(SILENT_CONSOLE)) {
+ if (CONFIG_IS_ENABLED(SHOW_ERRORS))
+ printf(PHASE_PROMPT
+ "Unsupported Boot Device %d\n",
+ bootdev);
+ else
+ printf(PHASE_PROMPT
+ "Unsupported Boot Device!\n");
}
}
---
base-commit: 08bf42e1faa4411cd347c2e370da790a0116e318
change-id: 20251031-spl_loader_fix-b3b7e19af723
Best regards,
--
Anshul Dalal <anshuld at ti.com>
More information about the U-Boot
mailing list