From patchwork Fri Sep 25 18:06:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balasubramanian Manoharan X-Patchwork-Id: 54175 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 6BAEA22B1E for ; Fri, 25 Sep 2015 18:07:29 +0000 (UTC) Received: by wicmn1 with SMTP id mn1sf11767470wic.1 for ; Fri, 25 Sep 2015 11:07:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=eRjTnVcmsjJ1n6gBhBnH9m4C4n8HNvd8Jxm+VMDNm1Y=; b=Rh8lsVxD+Rv3I1VbGzfB4yThMupapLf/A/++bx7qdA8Df+hF05762SOALAdiLgL5hn ihCPDmwjzdI9va4uBeK2DlUpjFMR7MxZQsyOJyLGMc74OMzIfBz5o8j9OVvx9fxkzZUv 9w32hEe0uIsviB5O2uPKxpfN+/fg0RDXoCoZNy24K+h+KcpjwzRDeOE5SGm6dL6lsB0e PPTXFJQFABxj/zQfxyw1gZdxrl0nJBIY4PKLKBMfKJLY/SaxD/o+GpO/50SHHAoFWli8 Mt7Xhn+RcN1sOLbpcn7+kw+bXN2b/cmYRMJec50dlxZaCVliKjaOxjhfodqd62INxZUT Gyeg== X-Gm-Message-State: ALoCoQmMYc1J9ugJxlQMpWA7wcAkbC/zhGsqwHPw7MDcjuTPIluznEZS2iO9fWlwJel2QAzy3xi7 X-Received: by 10.180.10.202 with SMTP id k10mr750188wib.2.1443204448728; Fri, 25 Sep 2015 11:07:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.11 with SMTP id ua11ls140024lac.14.gmail; Fri, 25 Sep 2015 11:07:28 -0700 (PDT) X-Received: by 10.25.41.79 with SMTP id p76mr1371332lfp.16.1443204448575; Fri, 25 Sep 2015 11:07:28 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id b9si2219285laf.10.2015.09.25.11.07.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Sep 2015 11:07:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by lacrr8 with SMTP id rr8so27638235lac.2 for ; Fri, 25 Sep 2015 11:07:28 -0700 (PDT) X-Received: by 10.25.211.201 with SMTP id k192mr1408951lfg.32.1443204448253; Fri, 25 Sep 2015 11:07:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp197281lbq; Fri, 25 Sep 2015 11:07:27 -0700 (PDT) X-Received: by 10.50.6.16 with SMTP id w16mr4174387igw.74.1443204447205; Fri, 25 Sep 2015 11:07:27 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id s20si3700231ioe.199.2015.09.25.11.07.22; Fri, 25 Sep 2015 11:07:27 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 26340619B8; Fri, 25 Sep 2015 18:07:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 598506183C; Fri, 25 Sep 2015 18:07:18 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id AB6AE61980; Fri, 25 Sep 2015 18:07:16 +0000 (UTC) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by lists.linaro.org (Postfix) with ESMTPS id 7ACC56183C for ; Fri, 25 Sep 2015 18:07:15 +0000 (UTC) Received: by pablk4 with SMTP id lk4so15269439pab.3 for ; Fri, 25 Sep 2015 11:07:14 -0700 (PDT) X-Received: by 10.68.68.197 with SMTP id y5mr8852831pbt.88.1443204434847; Fri, 25 Sep 2015 11:07:14 -0700 (PDT) Received: from bala-Vostro-2520.domain.name ([117.207.64.60]) by smtp.gmail.com with ESMTPSA id gj10sm5058302pbc.68.2015.09.25.11.07.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Sep 2015 11:07:14 -0700 (PDT) From: Balasubramanian Manoharan To: lng-odp@lists.linaro.org Date: Fri, 25 Sep 2015 23:36:55 +0530 Message-Id: <1443204415-14134-1-git-send-email-bala.manoharan@linaro.org> X-Mailer: git-send-email 1.9.1 X-Topics: patch Subject: [lng-odp] [API-NEXT/PATCH] example: classifier: check return value X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: bala.manoharan@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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 Reviewed-by: Bill Fischofer --- 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); }