From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1E6A6A2EDB for ; Wed, 2 Oct 2019 03:28:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC8771BF2B; Wed, 2 Oct 2019 03:28:57 +0200 (CEST) Received: from mail-ot1-f66.google.com (mail-ot1-f66.google.com [209.85.210.66]) by dpdk.org (Postfix) with ESMTP id 2B9B11BF06 for ; Wed, 2 Oct 2019 03:28:54 +0200 (CEST) Received: by mail-ot1-f66.google.com with SMTP id y39so13326572ota.7 for ; Tue, 01 Oct 2019 18:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2p0SLRHVu0sO+OCuqx4RTnN5aFF0BuVUqDZiHPstoPk=; b=Ncz/mNvXP/xm77dDRYhjx3ytk4B+n3ZE/GwBoaZ5hC9BcJPwy1FiLwIleKecyv/L6b oLt4+GGdqSMZTd/QjkhoZScvt4US8zMo9zrBVAS4TmD6KGfpCouRdYUJV4zjjALhGqEA ofYYALD8EujWeRMS80Woh7ZWG08t5ASHx1CXU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2p0SLRHVu0sO+OCuqx4RTnN5aFF0BuVUqDZiHPstoPk=; b=BO1EpEg5bWOJlRhdz027dL02uvKTfeBq+rSolbaEQA5stqW+RF/u/rxX2/lnRrdyyK 8hHBFZeegDHf1l87PIeXS1Mq0V/KfJKJqvJvIHZClwv8TtV7ETPi3KTjwemEj4Lcryyb vSJNms8D4yInxkv1sQ4rc4q5Oj06BdYPGrgstQFPjnpY5MxKz4cMcSOlEQrDSSKmxd0S 40yx/DBw74S4Dkecdu8etZBXrrAuanGREUiTpLF9J8dKqe4QBZECSGfUlkm0qxqJSKsR Fs9z90H3wAONPy6gJ0bijLyB6dZEdsUJqvVXDZt5Yqp/QXdwrD09Mvuu64wj3syLF8T3 qiMw== X-Gm-Message-State: APjAAAUYE90Ed1jJNOlozExv4o+n9oqmdOO8q9CpGk4dM2WqwesCNcUt aWtpH8HNQ1BgnREDMrR4EiMw/qa13wsTFFYmwkMD6w== X-Google-Smtp-Source: APXvYqz3m4JZiXUgjuingjqQ7pRZjpoSqVGoRWXL9KPM/wJKDkxNWDzPUljVo1LIZrRwYZoymLUvbVSTzJy/k+w3GPo= X-Received: by 2002:a05:6830:1492:: with SMTP id s18mr714384otq.283.1569979733210; Tue, 01 Oct 2019 18:28:53 -0700 (PDT) MIME-Version: 1.0 References: <20191001125315.6191-1-ktraynor@redhat.com> <20191001130405.7076-1-ktraynor@redhat.com> <20191001130405.7076-2-ktraynor@redhat.com> In-Reply-To: <20191001130405.7076-2-ktraynor@redhat.com> From: Ajit Khaparde Date: Tue, 1 Oct 2019 18:28:36 -0700 Message-ID: To: Kevin Traynor Cc: dev@dpdk.org, Lance Richardson , dpdk stable Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH 3/9] net/bnxt: remove logically dead code X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Oct 1, 2019 at 6:04 AM Kevin Traynor wrote: > If rc contains a non-zero return code from bnxt_hwrm_send_message(), > HWRM_CHECK_RESULT_SILENT() will return. > > Just after that code, there is an 'if (!rc) {...} else {...}'. > Coverity is complaining that this if else statement is dead code as > rc will always be 0 if that code is reached. > > 4309 rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), > BNXT_USE_CHIMP_MB); > cond_const: Condition rc, taking false branch. > Now the value of rc is equal to 0. > 4310 HWRM_CHECK_RESULT_SILENT(); > 4311 > const: At condition rc, the value of rc must be equal to 0. > dead_error_condition: The condition !rc must be true. > 4312 if (!rc) { > > [snip] > > 4373 } else { > CID 343450 (#1 of 1): Logically dead code > (DEADCODE)dead_error_line: Execution cannot > reach this statement: rc = 0;. > 4374 rc = 0; > 4375 } > > Coverity issue: 343450 > Fixes: f8168ca0e690 ("net/bnxt: support thor controller") > Cc: lance.richardson@broadcom.com > Cc: stable@dpdk.org > > Signed-off-by: Kevin Traynor > Acked-by: Ajit Khaparde > --- > drivers/net/bnxt/bnxt_hwrm.c | 118 +++++++++++++++++------------------ > 1 file changed, 56 insertions(+), 62 deletions(-) > > diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c > index 9883fb506..5378e3e9c 100644 > --- a/drivers/net/bnxt/bnxt_hwrm.c > +++ b/drivers/net/bnxt/bnxt_hwrm.c > @@ -4298,5 +4298,7 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt > *bp) > struct hwrm_func_backing_store_qcaps_output *resp = > bp->hwrm_cmd_resp_addr; > - int rc; > + struct bnxt_ctx_pg_info *ctx_pg; > + struct bnxt_ctx_mem_info *ctx; > + int rc, total_alloc_len, i; > > if (!BNXT_CHIP_THOR(bp) || > @@ -4310,68 +4312,60 @@ int bnxt_hwrm_func_backing_store_qcaps(struct bnxt > *bp) > HWRM_CHECK_RESULT_SILENT(); > > - if (!rc) { > - struct bnxt_ctx_pg_info *ctx_pg; > - struct bnxt_ctx_mem_info *ctx; > - int total_alloc_len; > - int i; > + total_alloc_len = sizeof(*ctx); > + ctx = rte_malloc("bnxt_ctx_mem", total_alloc_len, > + RTE_CACHE_LINE_SIZE); > + if (!ctx) { > + rc = -ENOMEM; > + goto ctx_err; > + } > + memset(ctx, 0, total_alloc_len); > > - total_alloc_len = sizeof(*ctx); > - ctx = rte_malloc("bnxt_ctx_mem", total_alloc_len, > - RTE_CACHE_LINE_SIZE); > - if (!ctx) { > - rc = -ENOMEM; > - goto ctx_err; > - } > - memset(ctx, 0, total_alloc_len); > + ctx_pg = rte_malloc("bnxt_ctx_pg_mem", > + sizeof(*ctx_pg) * BNXT_MAX_Q, > + RTE_CACHE_LINE_SIZE); > + if (!ctx_pg) { > + rc = -ENOMEM; > + goto ctx_err; > + } > + for (i = 0; i < BNXT_MAX_Q; i++, ctx_pg++) > + ctx->tqm_mem[i] = ctx_pg; > > - ctx_pg = rte_malloc("bnxt_ctx_pg_mem", > - sizeof(*ctx_pg) * BNXT_MAX_Q, > - RTE_CACHE_LINE_SIZE); > - if (!ctx_pg) { > - rc = -ENOMEM; > - goto ctx_err; > - } > - for (i = 0; i < BNXT_MAX_Q; i++, ctx_pg++) > - ctx->tqm_mem[i] = ctx_pg; > + bp->ctx = ctx; > + ctx->qp_max_entries = rte_le_to_cpu_32(resp->qp_max_entries); > + ctx->qp_min_qp1_entries = > + rte_le_to_cpu_16(resp->qp_min_qp1_entries); > + ctx->qp_max_l2_entries = > + rte_le_to_cpu_16(resp->qp_max_l2_entries); > + ctx->qp_entry_size = rte_le_to_cpu_16(resp->qp_entry_size); > + ctx->srq_max_l2_entries = > + rte_le_to_cpu_16(resp->srq_max_l2_entries); > + ctx->srq_max_entries = rte_le_to_cpu_32(resp->srq_max_entries); > + ctx->srq_entry_size = rte_le_to_cpu_16(resp->srq_entry_size); > + ctx->cq_max_l2_entries = > + rte_le_to_cpu_16(resp->cq_max_l2_entries); > + ctx->cq_max_entries = rte_le_to_cpu_32(resp->cq_max_entries); > + ctx->cq_entry_size = rte_le_to_cpu_16(resp->cq_entry_size); > + ctx->vnic_max_vnic_entries = > + rte_le_to_cpu_16(resp->vnic_max_vnic_entries); > + ctx->vnic_max_ring_table_entries = > + rte_le_to_cpu_16(resp->vnic_max_ring_table_entries); > + ctx->vnic_entry_size = rte_le_to_cpu_16(resp->vnic_entry_size); > + ctx->stat_max_entries = > + rte_le_to_cpu_32(resp->stat_max_entries); > + ctx->stat_entry_size = rte_le_to_cpu_16(resp->stat_entry_size); > + ctx->tqm_entry_size = rte_le_to_cpu_16(resp->tqm_entry_size); > + ctx->tqm_min_entries_per_ring = > + rte_le_to_cpu_32(resp->tqm_min_entries_per_ring); > + ctx->tqm_max_entries_per_ring = > + rte_le_to_cpu_32(resp->tqm_max_entries_per_ring); > + ctx->tqm_entries_multiple = resp->tqm_entries_multiple; > + if (!ctx->tqm_entries_multiple) > + ctx->tqm_entries_multiple = 1; > + ctx->mrav_max_entries = > + rte_le_to_cpu_32(resp->mrav_max_entries); > + ctx->mrav_entry_size = rte_le_to_cpu_16(resp->mrav_entry_size); > + ctx->tim_entry_size = rte_le_to_cpu_16(resp->tim_entry_size); > + ctx->tim_max_entries = rte_le_to_cpu_32(resp->tim_max_entries); > > - bp->ctx = ctx; > - ctx->qp_max_entries = > rte_le_to_cpu_32(resp->qp_max_entries); > - ctx->qp_min_qp1_entries = > - rte_le_to_cpu_16(resp->qp_min_qp1_entries); > - ctx->qp_max_l2_entries = > - rte_le_to_cpu_16(resp->qp_max_l2_entries); > - ctx->qp_entry_size = rte_le_to_cpu_16(resp->qp_entry_size); > - ctx->srq_max_l2_entries = > - rte_le_to_cpu_16(resp->srq_max_l2_entries); > - ctx->srq_max_entries = > rte_le_to_cpu_32(resp->srq_max_entries); > - ctx->srq_entry_size = > rte_le_to_cpu_16(resp->srq_entry_size); > - ctx->cq_max_l2_entries = > - rte_le_to_cpu_16(resp->cq_max_l2_entries); > - ctx->cq_max_entries = > rte_le_to_cpu_32(resp->cq_max_entries); > - ctx->cq_entry_size = rte_le_to_cpu_16(resp->cq_entry_size); > - ctx->vnic_max_vnic_entries = > - rte_le_to_cpu_16(resp->vnic_max_vnic_entries); > - ctx->vnic_max_ring_table_entries = > - > rte_le_to_cpu_16(resp->vnic_max_ring_table_entries); > - ctx->vnic_entry_size = > rte_le_to_cpu_16(resp->vnic_entry_size); > - ctx->stat_max_entries = > - rte_le_to_cpu_32(resp->stat_max_entries); > - ctx->stat_entry_size = > rte_le_to_cpu_16(resp->stat_entry_size); > - ctx->tqm_entry_size = > rte_le_to_cpu_16(resp->tqm_entry_size); > - ctx->tqm_min_entries_per_ring = > - rte_le_to_cpu_32(resp->tqm_min_entries_per_ring); > - ctx->tqm_max_entries_per_ring = > - rte_le_to_cpu_32(resp->tqm_max_entries_per_ring); > - ctx->tqm_entries_multiple = resp->tqm_entries_multiple; > - if (!ctx->tqm_entries_multiple) > - ctx->tqm_entries_multiple = 1; > - ctx->mrav_max_entries = > - rte_le_to_cpu_32(resp->mrav_max_entries); > - ctx->mrav_entry_size = > rte_le_to_cpu_16(resp->mrav_entry_size); > - ctx->tim_entry_size = > rte_le_to_cpu_16(resp->tim_entry_size); > - ctx->tim_max_entries = > rte_le_to_cpu_32(resp->tim_max_entries); > - } else { > - rc = 0; > - } > ctx_err: > HWRM_UNLOCK(); > -- > 2.21.0 > >