[PATCH] cmd: mbr: return false instead of NULL from bool found_key()

Naveen Kumar Chaudhary naveen.osdev at gmail.com
Fri Jul 10 17:22:15 CEST 2026


found_key() is declared to return bool but returns NULL when strdup()
fails. NULL is a pointer constant; while it happens to convert to
zero (i.e. false) it is a type mismatch that trips stricter
compilers/static analysers.

Return false to match the declared return type.

Signed-off-by: Naveen Kumar Chaudhary <naveen.osdev at gmail.com>
---
 cmd/mbr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/mbr.c b/cmd/mbr.c
index 7fe6c9e103a..b282b68d50e 100644
--- a/cmd/mbr.c
+++ b/cmd/mbr.c
@@ -73,7 +73,7 @@ static bool found_key(const char *str, const char *key)
 
 	strcopy = strdup(str);
 	if (!strcopy)
-		return NULL;
+		return false;
 
 	s = strcopy;
 	while (s) {
-- 
2.43.0



More information about the U-Boot mailing list