[PATCH v2025.09.y 33/58] of: overlay: initialize ret to fix garbage return value
Ahmad Fatoum
a.fatoum at pengutronix.de
Fri Mar 13 06:25:17 PDT 2026
If the FIT image has no valid overlay configuration nodes, the
for_each_child_of_node loop never executes and ret is returned
uninitialized. Initialize it to 0 since having no overlay
configurations to apply is not an error.
(cherry picked from commit 2fb737e978c1e9baccdbb0ae2901bef387f39917)
Reported-by: GCC 14.2 -fanalyzer
Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
Link: https://lore.barebox.org/20260216084142.3546363-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
drivers/of/overlay.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index bad7769187f1..76dc955a9300 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -540,7 +540,7 @@ static int of_overlay_global_fixup_fit(struct device_node *root,
enum bootm_verify verify = bootm_get_verify_mode();
struct device_node *conf_node;
struct fit_handle *fit;
- int ret;
+ int ret = 0;
if (!IS_ENABLED(CONFIG_FITIMAGE)) {
pr_err("FIT based overlay handling requested while CONFIG_FITIMAGE=n\n");
--
2.47.3
More information about the barebox
mailing list