From patchwork Mon Jun 6 21:15:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9159163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 08A2260573 for ; Mon, 6 Jun 2016 21:15:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF349281F9 for ; Mon, 6 Jun 2016 21:15:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E296828326; Mon, 6 Jun 2016 21:15:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C0C9281F9 for ; Mon, 6 Jun 2016 21:15:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752774AbcFFVPO (ORCPT ); Mon, 6 Jun 2016 17:15:14 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:36509 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751702AbcFFVPN (ORCPT ); Mon, 6 Jun 2016 17:15:13 -0400 Received: by mail-wm0-f67.google.com with SMTP id m124so18393066wme.3; Mon, 06 Jun 2016 14:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=CWNGJtvBF835vstAz3apcpD6lzTsdX7hoxgSn61FwNc=; b=jJEfBa3qLuyJf2tJcKl4Xrp7wXUgXe8XsScDSKptJMUVX3YxUZoZ6DHNHmwlwV72Kh S7HiiT/WxZ8abxdhUDhcCskca3+HTexJOiabkDMY5yRvnd0yHEZrigu8c0cEgwUx/G4e JR46/636N5PW/muxkz9FHLibNiljFVkIHckWEVm4vAjRkwEKq1pB9MtdvLok/F5K9f3g jrX8ZATkOIYIlfn5odf/lFYqeW8SdRHtFerhh+AkOyYXQitAmlNo29pGOpI1/G/z1sX2 aBgwcbvImRwlSG3YuhKGUWcpuVe8IIZwzKxP/q37ayUGzCOElxR7pENrZ6FXMPI5P6EZ jm6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CWNGJtvBF835vstAz3apcpD6lzTsdX7hoxgSn61FwNc=; b=mNw8M0aiRDDvgAqE8zvojXnKQvLghucOQr9UcEVBoy6zXGizPkzv4tZOA9v6GUGcOm J1ABrISffKk6W6zGgJTx6afl3m67sYsFzoPJ/zaAvGefaooSZD+xvptEJR1VFJgwmxWy xIaPWSmWTdSxiRkd+n3W0Ulf7faq+OXg4V7b4cFVUw94/YOX9qTx+9eIbo4fniBGKaAR +0IKELz8mUuNVQpymaqYmCtfFppkjjFcyW2RVUMy6cvRdMwfz4ajbeV0iircWR06BsNP laxA+GQCMGrR8RtY9HFag2w2j49DDXyyIQ0FIyvJC0H7oVDAxgMKn6LbG1dO2wdMyJsH hHog== X-Gm-Message-State: ALyK8tI7Qh1wbkmoaS3aaWeFxENHCdaOWgz+jBNwVrbxkGFN4oe/j1crhxbm7v+VdvUcMw== X-Received: by 10.28.157.23 with SMTP id g23mr744851wme.34.1465247712106; Mon, 06 Jun 2016 14:15:12 -0700 (PDT) Received: from sudip-laptop.lan (234.98.208.46.dyn.plus.net. [46.208.98.234]) by smtp.gmail.com with ESMTPSA id xz3sm22044561wjb.35.2016.06.06.14.15.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Jun 2016 14:15:11 -0700 (PDT) From: Sudip Mukherjee To: Doug Ledford , Sean Hefty , Hal Rosenstock Cc: linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Sudip Mukherjee , leon@kernel.org Subject: [PATCH v2] IB/core: remove dead code Date: Mon, 6 Jun 2016 22:15:06 +0100 Message-Id: <1465247706-4418-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP prot_sg_cnt has been assigned with the value of ret which we have already checked to be non-zero so prot_sg_cnt can never be zero at this point of the code and hence the else part can never execute. And since we know prot_sg_cnt is non zero there is no use for the if condition also. Signed-off-by: Sudip Mukherjee --- drivers/infiniband/core/rw.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/drivers/infiniband/core/rw.c b/drivers/infiniband/core/rw.c index 1eb9b12..a829a14 100644 --- a/drivers/infiniband/core/rw.c +++ b/drivers/infiniband/core/rw.c @@ -386,21 +386,17 @@ int rdma_rw_ctx_signature_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, count += ret; prev_wr = &ctx->sig->data.reg_wr.wr; - if (prot_sg_cnt) { - ret = rdma_rw_init_one_mr(qp, port_num, &ctx->sig->prot, - prot_sg, prot_sg_cnt, 0); - if (ret < 0) - goto out_destroy_data_mr; - count += ret; + ret = rdma_rw_init_one_mr(qp, port_num, &ctx->sig->prot, + prot_sg, prot_sg_cnt, 0); + if (ret < 0) + goto out_destroy_data_mr; + count += ret; - if (ctx->sig->prot.inv_wr.next) - prev_wr->next = &ctx->sig->prot.inv_wr; - else - prev_wr->next = &ctx->sig->prot.reg_wr.wr; - prev_wr = &ctx->sig->prot.reg_wr.wr; - } else { - ctx->sig->prot.mr = NULL; - } + if (ctx->sig->prot.inv_wr.next) + prev_wr->next = &ctx->sig->prot.inv_wr; + else + prev_wr->next = &ctx->sig->prot.reg_wr.wr; + prev_wr = &ctx->sig->prot.reg_wr.wr; ctx->sig->sig_mr = ib_mr_pool_get(qp, &qp->sig_mrs); if (!ctx->sig->sig_mr) {