From patchwork Wed Oct 18 15:00:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 116316 Delivered-To: patch@linaro.org Received: by 10.80.163.170 with SMTP id s39csp2468601edb; Wed, 18 Oct 2017 08:04:02 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Q7q/z+W64LTmiptgK/FLyxaNpyFCK3g2rAszYpWVrXPuNGsK23Hii6ahjjVje3w2Fo4GlV X-Received: by 10.107.102.14 with SMTP id a14mr22891057ioc.60.1508339042681; Wed, 18 Oct 2017 08:04:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508339042; cv=none; d=google.com; s=arc-20160816; b=lwJmPxXCF9lCCEx5SNssPdmq6SDuAXWgv5wpcwmOfw5ICJuVmWJ5AOC0KNLQd6plI7 8wqeJnJd7iUyvV2VxQMaGuVehkzSKhagQahxmg560dxqQeVMLMNrMNKKNpa4afTvoXLb tK41veHeyc8KW2I6T8PMhyl+xmDRAsNdAN23gOrF8+MJKTIc71bel1906l0qwPftQzun 8VRGdzwCuTLnWL2YFHNltw98tF2QnY/k6QkDipir2KUi/F5WV/YSQu5W3X3RwHvv5h9S sTSZ9ypL9osRsHabeg/sIzv0iEV759UPM1p+qTwtj/ZaIeBC66FNjpKr/Sp5TPur9EVP XaWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ve3Ye90EdeD+C05d1wTx2TqyFpDtA2WvdcMyAsJoZWY=; b=acehD58tNCCvd6IoEE6mf97SFsQDPQny4cPHxMB5jSEDaK7eo8MpBm9UbdPM7fd3zY yG+TGO9keQ4OJdKr478c/CLENzMmQPBfvoMqN2YllAENS5wn4CLbXjaKE1JTIvgOJG8o PuDDFkGtvi9q0eDgTwNU7mYlnegPDoyT5rIx0pP0bCq2gXEdnBCf2zGqrCRLXrs/vJz3 cSZ9QF6+Rl2GsMZKYug1N0M5go2C8QAitaxJLRvuoLjv2PAIYd/WFrojg/iSygzdGHpX Q0i8ORFPkxj6wb7nDYZ7Nqf3nd7+GTzz0mh+RM4p7GFevbrgv6Ge8aKbGMbsdMILDAOU orZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id a62si9317282ith.50.2017.10.18.08.04.00; Wed, 18 Oct 2017 08:04:02 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 44DE462D4C; Wed, 18 Oct 2017 15:04:00 +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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, 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 72187629BA; Wed, 18 Oct 2017 15:01:40 +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 50BFD6102F; Wed, 18 Oct 2017 15:01:23 +0000 (UTC) Received: from forward105j.mail.yandex.net (forward105j.mail.yandex.net [5.45.198.248]) by lists.linaro.org (Postfix) with ESMTPS id E0EB36291E for ; Wed, 18 Oct 2017 15:00:24 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward105j.mail.yandex.net (Yandex) with ESMTP id 7854B183227 for ; Wed, 18 Oct 2017 18:00:23 +0300 (MSK) Received: from smtp4j.mail.yandex.net (smtp4j.mail.yandex.net [2a02:6b8:0:1619::15:6]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id O7zOQqu8qr-0NSmtpRk; Wed, 18 Oct 2017 18:00:23 +0300 Received: by smtp4j.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 6SG6N26vxh-0NCOhT6v; Wed, 18 Oct 2017 18:00:23 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 18 Oct 2017 18:00:06 +0300 Message-Id: <1508338806-1394-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1508338806-1394-1-git-send-email-odpbot@yandex.ru> References: <1508338806-1394-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 239 Subject: [lng-odp] [PATCH v1 3/3] linux-gen: pktio: do not set pktio ops on not allocated state X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Maxim Uvarov Simplify ret code. Signed-off-by: Maxim Uvarov --- /** Email created from pull request 239 (muvarov:master_bug3242) ** https://github.com/Linaro/odp/pull/239 ** Patch: https://github.com/Linaro/odp/pull/239.patch ** Base sha: ec0c3145fcafa09ae3a79875e7e07dd4794583cc ** Merge commit sha: 13cc3007dc36c8942ffe7dd834f3812b32ae2ae3 **/ platform/linux-generic/odp_packet_io.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 4363711fb..f972bb78f 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -215,27 +215,25 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, for (pktio_if = 0; pktio_if_ops[pktio_if]; ++pktio_if) { ret = pktio_if_ops[pktio_if]->open(hdl, pktio_entry, name, pool); - - if (!ret) { - pktio_entry->s.ops = pktio_if_ops[pktio_if]; - ODP_DBG("%s uses %s\n", - name, pktio_if_ops[pktio_if]->name); + if (!ret) break; - } } if (ret != 0) { pktio_entry->s.state = PKTIO_STATE_FREE; - hdl = ODP_PKTIO_INVALID; + unlock_entry(pktio_entry); ODP_ERR("Unable to init any I/O type.\n"); - } else { - snprintf(pktio_entry->s.name, - sizeof(pktio_entry->s.name), "%s", name); - pktio_entry->s.state = PKTIO_STATE_OPENED; + return ODP_PKTIO_INVALID; } + snprintf(pktio_entry->s.name, + sizeof(pktio_entry->s.name), "%s", name); + pktio_entry->s.state = PKTIO_STATE_OPENED; + pktio_entry->s.ops = pktio_if_ops[pktio_if]; unlock_entry(pktio_entry); + ODP_DBG("%s uses %s\n", name, pktio_if_ops[pktio_if]->name); + return hdl; }