From patchwork Tue Feb 24 08:03:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 44926 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8A8122029F for ; Tue, 24 Feb 2015 08:04:05 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id bs8sf13507361wib.2 for ; Tue, 24 Feb 2015 00:04:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state: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=dyGhrFg6gHTsaIAw0X9P5xTF76JSHtfasDG8tT6F18U=; b=l8zpXaKnS8ZQRzlHq/8kXddLrbP2S3t9hst3rRH8NvpCOMzC9Pz1cQQrB7rs8VCAkF iolex0dsL33Zi/9hzCqM1a7i5syYVjWhlX92JywcCp9s5L2ruschSTCrLZdxQTp0zSac VQm1vXxezpxRMq5blambmz3jrEUoSaZV+OaS0uHmerTZJulRTu3n0mG7wfng3YSjDagT 6tQIwqmnyd/BQirulQuNpb8PHx2uV8tDMh7IaiHZvPxJCqhTnX6sfUWmrRx3DTNKV3xw fA8RSJ1Or1SDz1kbPMlhdoSp5ZyEefQrxS2YyBSJ9VibeIhX/jGGErBdwzZnKBtC/K9Z 8MXA== X-Gm-Message-State: ALoCoQlwnkI/wr7oGpR1WIIUOD3TsXVT5jBuKT+rCI+FNoQrlbvXfSFeEGMewXKnoGmPrmzehL+a X-Received: by 10.180.101.101 with SMTP id ff5mr1854211wib.5.1424765044795; Tue, 24 Feb 2015 00:04:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.7.208 with SMTP id l16ls577744laa.66.gmail; Tue, 24 Feb 2015 00:04:04 -0800 (PST) X-Received: by 10.112.139.168 with SMTP id qz8mr13206858lbb.84.1424765044633; Tue, 24 Feb 2015 00:04:04 -0800 (PST) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id c6si5233263lah.174.2015.02.24.00.04.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Feb 2015 00:04:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbvp9 with SMTP id p9so23406257lbv.0 for ; Tue, 24 Feb 2015 00:04:04 -0800 (PST) X-Received: by 10.152.43.51 with SMTP id t19mr13081824lal.73.1424765044297; Tue, 24 Feb 2015 00:04:04 -0800 (PST) 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.35.133 with SMTP id h5csp1758731lbj; Tue, 24 Feb 2015 00:04:03 -0800 (PST) X-Received: by 10.140.150.149 with SMTP id 143mr34621189qhw.4.1424765042888; Tue, 24 Feb 2015 00:04:02 -0800 (PST) Received: from ip-10-35-177-41.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id p20si38536254qgd.117.2015.02.24.00.04.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 24 Feb 2015 00:04:02 -0800 (PST) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-35-177-41.ec2.internal) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQATF-0003Ol-UG; Tue, 24 Feb 2015 08:03:57 +0000 Received: from mail-la0-f48.google.com ([209.85.215.48]) by ip-10-35-177-41.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1YQAT9-0003K1-Ow for lng-odp@lists.linaro.org; Tue, 24 Feb 2015 08:03:51 +0000 Received: by labgf13 with SMTP id gf13so1335314lab.0 for ; Tue, 24 Feb 2015 00:03:45 -0800 (PST) X-Received: by 10.112.140.74 with SMTP id re10mr13472279lbb.80.1424765025214; Tue, 24 Feb 2015 00:03:45 -0800 (PST) Received: from localhost.localdomain (broadband-46-188-125-106.2com.net. [46.188.125.106]) by mx.google.com with ESMTPSA id jr1sm7676548lbc.12.2015.02.24.00.03.43 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Feb 2015 00:03:44 -0800 (PST) From: Maxim Uvarov To: lng-odp@lists.linaro.org Date: Tue, 24 Feb 2015 11:03:38 +0300 Message-Id: <1424765018-19634-1-git-send-email-maxim.uvarov@linaro.org> X-Mailer: git-send-email 1.8.5.1.163.gd7aced9 X-Topics: Classification patch Subject: [lng-odp] [PATCHv2] validation: classification: fix unchecked return value X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: maxim.uvarov@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.217.179 as permitted sender) smtp.mail=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 From: Balasubramanian Manoharan Fix for return value checking of odp_pool_destroy() function reported by Coverity. https://bugs.linaro.org/show_bug.cgi?id=1142 Signed-off-by: Balasubramanian Manoharan Signed-off-by: Maxim Uvarov Reviewed-by: Balasubramanian Manoharan --- v2: Bala, that is your patch but I think it's reasonable to remove gotos. You use them only once in function so just return there makes code simple. What do you think? .../classification/odp_classification_tests.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/test/validation/classification/odp_classification_tests.c b/test/validation/classification/odp_classification_tests.c index 564455c..0537d99 100644 --- a/test/validation/classification/odp_classification_tests.c +++ b/test/validation/classification/odp_classification_tests.c @@ -246,6 +246,7 @@ int classification_tests_init(void) odp_queue_param_t qparam; char queuename[ODP_QUEUE_NAME_LEN]; int i; + int ret; memset(¶m, 0, sizeof(param)); param.pkt.seg_len = SHM_PKT_BUF_SIZE; @@ -262,11 +263,15 @@ int classification_tests_init(void) pool_default = odp_pool_lookup("classification_pool"); if (pool_default == ODP_POOL_INVALID) - goto error_pool_default; + return -1; pktio_loop = odp_pktio_open("loop", pool_default); - if (pktio_loop == ODP_PKTIO_INVALID) - goto error_pktio_loop; + if (pktio_loop == ODP_PKTIO_INVALID) { + ret = odp_pool_destroy(pool_default); + if (ret) + fprintf(stderr, "unable to destroy pool.\n"); + return -1; + } qparam.sched.prio = ODP_SCHED_PRIO_DEFAULT; qparam.sched.sync = ODP_SCHED_SYNC_ATOMIC; qparam.sched.group = ODP_SCHED_GROUP_DEFAULT; @@ -286,12 +291,6 @@ int classification_tests_init(void) queue_list[i] = ODP_QUEUE_INVALID; return 0; - -error_pktio_loop: - odp_pool_destroy(pool_default); - -error_pool_default: - return -1; } int classification_tests_finalize(void)