pdump: fix error code check when creating/canceling pthread
[dpdk.git] / app / test-pmd / cmdline_tm.c
index 964ce9d..803fae4 100644 (file)
@@ -1599,12 +1599,6 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
-       /* Port status */
-       if (port_is_started(port_id)) {
-               printf(" Port %u not stopped (error)\n", port_id);
-               return;
-       }
-
        memset(&np, 0, sizeof(struct rte_tm_node_params));
 
        /* Node parameters */
@@ -1615,6 +1609,11 @@ static void cmd_add_port_tm_nonleaf_node_parsed(void *parsed_result,
 
        shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
                sizeof(uint32_t));
+       if (shared_shaper_id == NULL) {
+               printf(" Memory not allocated for shared shapers (error)\n");
+               return;
+       }
+
        /* Parse multi shared shaper id string */
        ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
        if (ret) {
@@ -1754,12 +1753,6 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
-       /* Port status */
-       if (port_is_started(port_id)) {
-               printf(" Port %u not stopped (error)\n", port_id);
-               return;
-       }
-
        memset(&np, 0, sizeof(struct rte_tm_node_params));
 
        /* Node parameters */
@@ -1770,6 +1763,11 @@ static void cmd_add_port_tm_leaf_node_parsed(void *parsed_result,
 
        shared_shaper_id = (uint32_t *)malloc(MAX_NUM_SHARED_SHAPERS *
                sizeof(uint32_t));
+       if (shared_shaper_id == NULL) {
+               printf(" Memory not allocated for shared shapers (error)\n");
+               return;
+       }
+
        /* Parse multi shared shaper id string */
        ret = parse_multi_ss_id_str(s_str, &n_shared_shapers, shared_shaper_id);
        if (ret) {
@@ -2033,12 +2031,6 @@ static void cmd_port_tm_hierarchy_commit_parsed(void *parsed_result,
        if (port_id_is_invalid(port_id, ENABLED_WARN))
                return;
 
-       /* Port status */
-       if (port_is_started(port_id)) {
-               printf(" Port %u not stopped (error)\n", port_id);
-               return;
-       }
-
        if (strcmp(res->clean_on_fail, "yes") == 0)
                clean_on_fail = 1;
        else