Add command for handling DDR ECC registers on MPC8349EE MDS board.
[oweals/u-boot.git] / common / main.c
index 29226244a1af4afa4af92ade7ce5a3a2446719a2..445cb18491b0688eaad32a774583a5203ac1c21b 100644 (file)
@@ -26,6 +26,9 @@
 #include <common.h>
 #include <watchdog.h>
 #include <command.h>
+#ifdef CONFIG_MODEM_SUPPORT
+#include <malloc.h>            /* for free() prototype */
+#endif
 
 #ifdef CFG_HUSH_PARSER
 #include <hush.h>
@@ -344,7 +347,7 @@ void main_loop (void)
 #ifdef CONFIG_MODEM_SUPPORT
        debug ("DEBUG: main_loop:   do_mdm_init=%d\n", do_mdm_init);
        if (do_mdm_init) {
-               uchar *str = strdup(getenv("mdm_cmd"));
+               char *str = strdup(getenv("mdm_cmd"));
                setenv ("preboot", str);  /* set or delete definition */
                if (str != NULL)
                        free (str);
@@ -916,7 +919,10 @@ int run_command (const char *cmd, int flag)
                process_macros (token, finaltoken);
 
                /* Extract arguments */
-               argc = parse_line (finaltoken, argv);
+               if ((argc = parse_line (finaltoken, argv)) == 0) {
+                       rc = -1;        /* no command at all */
+                       continue;
+               }
 
                /* Look up command in command table */
                if ((cmdtp = find_cmd(argv[0])) == NULL) {
@@ -942,9 +948,9 @@ int run_command (const char *cmd, int flag)
                                puts ("'bootd' recursion detected\n");
                                rc = -1;
                                continue;
-                       }
-                       else
+                       } else {
                                flag |= CMD_FLAG_BOOTD;
+                       }
                }
 #endif /* CFG_CMD_BOOTD */