[PATCH 1/5] commands: menu: check return pointer properly

Lucas Stach dev at lynxeye.de
Wed Jul 6 12:32:48 PDT 2016


The called functions return error codes encoded in the pointer,
so the NULL check will never be true.

Signed-off-by: Lucas Stach <dev at lynxeye.de>
---
 commands/menu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/menu.c b/commands/menu.c
index 9ec2d57..e1079fd 100644
--- a/commands/menu.c
+++ b/commands/menu.c
@@ -83,7 +83,7 @@ static int do_menu_entry_add(struct cmd_menu *cm)
 	else
 		me = menu_add_command_entry(m, cm->description, cm->command,
 					    cm->type);
-	if (!me)
+	if (IS_ERR(me))
 		return PTR_ERR(me);
 
 	me->box_state = cm->box_state > 0 ? 1 : 0;
-- 
2.7.4




More information about the barebox mailing list