diff mbox

[API-NEXT/PATCH] example: classifier: check return value

Message ID 1443204415-14134-1-git-send-email-bala.manoharan@linaro.org
State Accepted
Commit a3741faa3344873da8c02390b2fabcd5df375ddb
Headers show

Commit Message

Balasubramanian Manoharan Sept. 25, 2015, 6:06 p.m. UTC
Checks return value of odp_cos_queue_set() and
odp_pktio_default_cos_set() functions.

Fixes: https://bugs.linaro.org/show_bug.cgi?id=1786

Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
---
 example/classifier/odp_classifier.c | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

Comments

Bill Fischofer Sept. 30, 2015, 10:33 a.m. UTC | #1
On Fri, Sep 25, 2015 at 1:06 PM, Balasubramanian Manoharan <
bala.manoharan@linaro.org> wrote:

> Checks return value of odp_cos_queue_set() and
> odp_pktio_default_cos_set() functions.
>
> Fixes: https://bugs.linaro.org/show_bug.cgi?id=1786
>
> Signed-off-by: Balasubramanian Manoharan <bala.manoharan@linaro.org>
>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  example/classifier/odp_classifier.c | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/example/classifier/odp_classifier.c
> b/example/classifier/odp_classifier.c
> index 2d90ae7..7790313 100644
> --- a/example/classifier/odp_classifier.c
> +++ b/example/classifier/odp_classifier.c
> @@ -331,8 +331,15 @@ static void configure_default_queue(odp_pktio_t
> pktio, appl_args_t *args)
>         queue_default = odp_queue_create(queue_name,
>                         ODP_QUEUE_TYPE_SCHED, &qparam);
>
> -       odp_cos_queue_set(cos_default, queue_default);
> -       odp_pktio_default_cos_set(pktio, cos_default);
> +       if (0 > odp_cos_queue_set(cos_default, queue_default)) {
> +               EXAMPLE_ERR("odp_cos_queue_set failed");
> +               exit(EXIT_FAILURE);
> +       }
> +
> +       if (0 > odp_pktio_default_cos_set(pktio, cos_default)) {
> +               EXAMPLE_ERR("odp_pktio_default_cos_set failed");
> +               exit(EXIT_FAILURE);
> +       }
>         stats[args->policy_count].cos = cos_default;
>         /* add default queue to global stats */
>         stats[args->policy_count].queue = queue_default;
> @@ -366,8 +373,15 @@ static void configure_cos_queue(odp_pktio_t pktio,
> appl_args_t *args)
>                 stats->queue = odp_queue_create(queue_name,
>                                                  ODP_QUEUE_TYPE_SCHED,
>                                                  &qparam);
> -               odp_cos_queue_set(stats->cos, stats->queue);
> -               odp_pktio_pmr_cos(stats->pmr, pktio, stats->cos);
> +               if (0 > odp_cos_queue_set(stats->cos, stats->queue)) {
> +                       EXAMPLE_ERR("odp_cos_queue_set failed");
> +                       exit(EXIT_FAILURE);
> +               }
> +
> +               if (0 > odp_pktio_pmr_cos(stats->pmr, pktio, stats->cos)) {
> +                       EXAMPLE_ERR("odp_pktio_pmr_cos failed");
> +                       exit(EXIT_FAILURE);
> +               }
>
>                 odp_atomic_init_u64(&stats->packet_count, 0);
>         }
> --
> 1.9.1
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov Sept. 30, 2015, 12:52 p.m. UTC | #2
Merged,
Maxim.

On 09/30/15 13:33, Bill Fischofer wrote:
>
>
> On Fri, Sep 25, 2015 at 1:06 PM, Balasubramanian Manoharan 
> <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>> wrote:
>
>     Checks return value of odp_cos_queue_set() and
>     odp_pktio_default_cos_set() functions.
>
>     Fixes: https://bugs.linaro.org/show_bug.cgi?id=1786
>
>     Signed-off-by: Balasubramanian Manoharan
>     <bala.manoharan@linaro.org <mailto:bala.manoharan@linaro.org>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      example/classifier/odp_classifier.c | 22 ++++++++++++++++++----
>      1 file changed, 18 insertions(+), 4 deletions(-)
>
>     diff --git a/example/classifier/odp_classifier.c
>     b/example/classifier/odp_classifier.c
>     index 2d90ae7..7790313 100644
>     --- a/example/classifier/odp_classifier.c
>     +++ b/example/classifier/odp_classifier.c
>     @@ -331,8 +331,15 @@ static void
>     configure_default_queue(odp_pktio_t pktio, appl_args_t *args)
>             queue_default = odp_queue_create(queue_name,
>                             ODP_QUEUE_TYPE_SCHED, &qparam);
>
>     -       odp_cos_queue_set(cos_default, queue_default);
>     -       odp_pktio_default_cos_set(pktio, cos_default);
>     +       if (0 > odp_cos_queue_set(cos_default, queue_default)) {
>     +               EXAMPLE_ERR("odp_cos_queue_set failed");
>     +               exit(EXIT_FAILURE);
>     +       }
>     +
>     +       if (0 > odp_pktio_default_cos_set(pktio, cos_default)) {
>     +               EXAMPLE_ERR("odp_pktio_default_cos_set failed");
>     +               exit(EXIT_FAILURE);
>     +       }
>             stats[args->policy_count].cos = cos_default;
>             /* add default queue to global stats */
>             stats[args->policy_count].queue = queue_default;
>     @@ -366,8 +373,15 @@ static void configure_cos_queue(odp_pktio_t
>     pktio, appl_args_t *args)
>                     stats->queue = odp_queue_create(queue_name,
>      ODP_QUEUE_TYPE_SCHED,
>      &qparam);
>     -               odp_cos_queue_set(stats->cos, stats->queue);
>     -               odp_pktio_pmr_cos(stats->pmr, pktio, stats->cos);
>     +               if (0 > odp_cos_queue_set(stats->cos, stats->queue)) {
>     +                       EXAMPLE_ERR("odp_cos_queue_set failed");
>     +                       exit(EXIT_FAILURE);
>     +               }
>     +
>     +               if (0 > odp_pktio_pmr_cos(stats->pmr, pktio,
>     stats->cos)) {
>     +                       EXAMPLE_ERR("odp_pktio_pmr_cos failed");
>     +                       exit(EXIT_FAILURE);
>     +               }
>
>     odp_atomic_init_u64(&stats->packet_count, 0);
>             }
>     --
>     1.9.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 2d90ae7..7790313 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -331,8 +331,15 @@  static void configure_default_queue(odp_pktio_t pktio, appl_args_t *args)
 	queue_default = odp_queue_create(queue_name,
 			ODP_QUEUE_TYPE_SCHED, &qparam);
 
-	odp_cos_queue_set(cos_default, queue_default);
-	odp_pktio_default_cos_set(pktio, cos_default);
+	if (0 > odp_cos_queue_set(cos_default, queue_default)) {
+		EXAMPLE_ERR("odp_cos_queue_set failed");
+		exit(EXIT_FAILURE);
+	}
+
+	if (0 > odp_pktio_default_cos_set(pktio, cos_default)) {
+		EXAMPLE_ERR("odp_pktio_default_cos_set failed");
+		exit(EXIT_FAILURE);
+	}
 	stats[args->policy_count].cos = cos_default;
 	/* add default queue to global stats */
 	stats[args->policy_count].queue = queue_default;
@@ -366,8 +373,15 @@  static void configure_cos_queue(odp_pktio_t pktio, appl_args_t *args)
 		stats->queue = odp_queue_create(queue_name,
 						 ODP_QUEUE_TYPE_SCHED,
 						 &qparam);
-		odp_cos_queue_set(stats->cos, stats->queue);
-		odp_pktio_pmr_cos(stats->pmr, pktio, stats->cos);
+		if (0 > odp_cos_queue_set(stats->cos, stats->queue)) {
+			EXAMPLE_ERR("odp_cos_queue_set failed");
+			exit(EXIT_FAILURE);
+		}
+
+		if (0 > odp_pktio_pmr_cos(stats->pmr, pktio, stats->cos)) {
+			EXAMPLE_ERR("odp_pktio_pmr_cos failed");
+			exit(EXIT_FAILURE);
+		}
 
 		odp_atomic_init_u64(&stats->packet_count, 0);
 	}