From patchwork Thu Apr 7 06:38:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxim Uvarov X-Patchwork-Id: 65228 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp289473lbc; Wed, 6 Apr 2016 23:38:38 -0700 (PDT) X-Received: by 10.50.59.244 with SMTP id c20mr1706675igr.16.1460011118805; Wed, 06 Apr 2016 23:38:38 -0700 (PDT) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id mu8si19754387igb.79.2016.04.06.23.38.38; Wed, 06 Apr 2016 23:38:38 -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; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 3354261B14; Thu, 7 Apr 2016 06:38:38 +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 2193E619B2; Thu, 7 Apr 2016 06:38:33 +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 BC0E8619CC; Thu, 7 Apr 2016 06:38:30 +0000 (UTC) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by lists.linaro.org (Postfix) with ESMTPS id 7400261567 for ; Thu, 7 Apr 2016 06:38:29 +0000 (UTC) Received: by mail-lb0-f181.google.com with SMTP id bk9so16410597lbc.3 for ; Wed, 06 Apr 2016 23:38:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Snml43fxT1o94ohYCp+ZAjDUGS2Ty4kiioAf3Is178k=; b=ikoPlg10ykOlEEk+DnRebL0lSH4216uuyzP95V0PniXcib7tc42ksx66B7go35OQ2f hIwaUOhTnIKKd0ltP5dcK1icIhewqnT3kJNX7Uwk0bLL0TEGP3ySZbFxsaQ06GOV/X3B NNQz+sWuQF9osDl7lKt0apfvtacPFgz5/T8uMZJgpRC8AtzXcrtrHLSoEPrDNTAeruM+ RJk22aXzmdy7Vz+nKllwU2zEWJl8+IcUcR00fwlMoVJvsbUWVxL2+exG4d8vosT8/mBN gKQ4cvoL+h8JKSBQyn8emJ/WokaXpxgzykDslgDml1/e0C+aj1efHYW3Ss68sKXorfNy zCYg== X-Gm-Message-State: AD7BkJImpVLkSbpJL4vTcaSYSZXP2paK9az+EyeqRx89eAsbSGbWLFrUeUI5wzR2GL9P1WXmACY= X-Received: by 10.112.129.169 with SMTP id nx9mr631123lbb.96.1460011107608; Wed, 06 Apr 2016 23:38:27 -0700 (PDT) Received: from [172.16.0.52] (mserver.d-systems.su. [185.75.190.112]) by smtp.gmail.com with ESMTPSA id ub6sm962338lbb.17.2016.04.06.23.38.26 for (version=TLSv1/SSLv3 cipher=OTHER); Wed, 06 Apr 2016 23:38:26 -0700 (PDT) To: lng-odp@lists.linaro.org References: <1459551806-19070-1-git-send-email-bill.fischofer@linaro.org> From: Maxim Uvarov Message-ID: <57060061.8070904@linaro.org> Date: Thu, 7 Apr 2016 09:38:25 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: X-Topics: patch Subject: Re: [lng-odp] [PATCH] linux-generic: queue: avoid false positive when compiling with -Og 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" Mike, it think it's better to remove handle and type completely. And if you already looking to that function it might be reasonable to make it more readable, use odp_config_queues() and use int instead of uint32_t. Something like that: if (param == NULL) { @@ -245,7 +243,7 @@ odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param) param = &default_param; } - for (i = 0; i < ODP_CONFIG_QUEUES; i++) { + for (i = 0; i < odp_config_queues(); i++) { queue = &queue_tbl->queue[i]; if (queue->s.status != QUEUE_STATUS_FREE) @@ -253,33 +251,29 @@ odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param) LOCK(&queue->s.lock); if (queue->s.status == QUEUE_STATUS_FREE) { - if (queue_init(queue, name, param)) { + if (queue_init(queue, name, param) || + queue->s.handle == ODP_QUEUE_INVALID) { UNLOCK(&queue->s.lock); - return handle; + return ODP_QUEUE_INVALID; } - type = queue->s.type; - - if (type == ODP_QUEUE_TYPE_SCHED) + if (queue->s.type == ODP_QUEUE_TYPE_SCHED) { queue->s.status = QUEUE_STATUS_NOTSCHED; - else + if (schedule_queue_init(queue)) { + ODP_ERR("schedule queue init failed\n"); + UNLOCK(&queue->s.lock); + return ODP_QUEUE_INVALID; + } + } else { queue->s.status = QUEUE_STATUS_READY; - - handle = queue->s.handle; + } UNLOCK(&queue->s.lock); - break; + return queue->s.handle; } UNLOCK(&queue->s.lock); } - if (handle != ODP_QUEUE_INVALID && type == ODP_QUEUE_TYPE_SCHED) { - if (schedule_queue_init(queue)) { - ODP_ERR("schedule queue init failed\n"); - return ODP_QUEUE_INVALID; - } - } - - return handle; + return ODP_QUEUE_INVALID; } Maxim. On 04/05/16 21:02, Mike Holmes wrote: > Any one object to this? > It impacts the accuracy of the ABI testing tools if -Og cannot be used. > > On 1 April 2016 at 19:03, Bill Fischofer > wrote: > > Resolve Bug https://bugs.linaro.org/show_bug.cgi?id=2159 by adding an > extraneous variable initialization to avoid a false positive error > when > compiling with gcc -Og > > Signed-off-by: Bill Fischofer > > --- > platform/linux-generic/odp_queue.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/platform/linux-generic/odp_queue.c > b/platform/linux-generic/odp_queue.c > index 342ffa2..5963057 100644 > --- a/platform/linux-generic/odp_queue.c > +++ b/platform/linux-generic/odp_queue.c > @@ -237,7 +237,7 @@ odp_queue_t odp_queue_create(const char *name, > const odp_queue_param_t *param) > uint32_t i; > queue_entry_t *queue; > odp_queue_t handle = ODP_QUEUE_INVALID; > - odp_queue_type_t type; > + odp_queue_type_t type = ODP_QUEUE_TYPE_PLAIN; > odp_queue_param_t default_param; > > if (param == NULL) { > -- > 2.5.0 > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp > > > > > -- > Mike Holmes > Technical Manager - Linaro Networking Group > Linaro.org ***│ *Open source software for ARM SoCs > "Work should be fun and collaborative, the rest follows" > > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/lng-odp --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -234,10 +234,8 @@ int odp_queue_lock_count(odp_queue_t handle) odp_queue_t odp_queue_create(const char *name, const odp_queue_param_t *param) { - uint32_t i; + int i; queue_entry_t *queue; - odp_queue_t handle = ODP_QUEUE_INVALID; - odp_queue_type_t type; odp_queue_param_t default_param;