dbg: add new db_unknown_command function to reduce redundand code
authorOleksij Rempel <linux@rempel-privat.de>
Tue, 23 Apr 2013 20:11:50 +0000 (22:11 +0200)
committerOleksij Rempel <linux@rempel-privat.de>
Tue, 23 Apr 2013 20:11:50 +0000 (22:11 +0200)
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
target_firmware/magpie_fw_dev/target/cmnos/dbg_api.c

index 66b25a514c57299d9d92607824a536997e69dcf5..d6e96bb04327e4ac10facdd1d96e21162ba89213 100755 (executable)
@@ -123,6 +123,11 @@ static void db_incorect_format(void)
        A_PRINTF("Error! Incorrect format.\n\r");
 }
 
+static void db_unknown_command(void)
+{
+       A_PRINTF("Error! Unknown command.\n\r");
+}
+
 static void zf_debug_init(void)
 {
        uint8_t ch;
@@ -823,11 +828,9 @@ static int db_cmd_sferase(char *cmd, char *param1, char *param2, char *param3)
                A_PRINTF("\n\r");
                return 0;
        }
-       else
-       {
-               A_PRINTF("Error! Unknown command.\n\r");
-               return -1;
-       }
+
+       db_unknown_command();
+       return -1;
 }
 
 /* Serial Flash -> Program */
@@ -865,7 +868,7 @@ static int db_cmd_sfru(char *cmd, char *param1, char *param2, char *param3)
                fast = 1;
        else
        {
-               A_PRINTF("Error! Unknown command.\n\r");
+               db_unknown_command();
                return -1;
        }
 
@@ -908,7 +911,7 @@ static int db_cmd_sfrm(char *cmd, char *param1, char *param2, char *param3)
                fast = 1;
        else
        {
-               A_PRINTF("Error! Unknown command.\n\r");
+               db_unknown_command();
                return -1;
        }