[PATCH master 19/39] efi: payload: fix inverted error check after state_load

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Feb 16 00:44:19 PST 2026


The condition 'ret != -ENOMEDIUM' is true for ret == 0 (success),
causing a spurious warning on every successful state load. Add a
check for ret != 0 first.

Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 efi/payload/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/efi/payload/init.c b/efi/payload/init.c
index d8a4410f22e6..f74ac4966fb1 100644
--- a/efi/payload/init.c
+++ b/efi/payload/init.c
@@ -316,7 +316,7 @@ static int efi_late_init(void)
 			return PTR_ERR(state);
 
 		ret = state_load(state);
-		if (ret != -ENOMEDIUM)
+		if (ret && ret != -ENOMEDIUM)
 			pr_warn("Failed to load persistent state, continuing with defaults, %d\n",
 				ret);
 
-- 
2.47.3




More information about the barebox mailing list