From patchwork Sat Apr 22 14:43:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 9694409 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 9A404601E9 for ; Sat, 22 Apr 2017 14:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8FFFB28174 for ; Sat, 22 Apr 2017 14:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8443328335; Sat, 22 Apr 2017 14:43:41 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 09F5128174 for ; Sat, 22 Apr 2017 14:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424237AbdDVOnj (ORCPT ); Sat, 22 Apr 2017 10:43:39 -0400 Received: from mout.web.de ([212.227.15.14]:54728 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424373AbdDVOni (ORCPT ); Sat, 22 Apr 2017 10:43:38 -0400 Received: from [192.168.1.2] ([77.181.100.232]) by smtp.web.de (mrweb003 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lo0YS-1cMHuv3XsO-00g1iq; Sat, 22 Apr 2017 16:43:18 +0200 Subject: [PATCH v2 05/12] IB/ocrdma: Delete unnecessary braces From: SF Markus Elfring To: Devesh Sharma , Doug Ledford , Hal Rosenstock , Sean Hefty , Selvin Xavier , Yuval Shaia , linux-rdma@vger.kernel.org Cc: LKML , kernel-janitors@vger.kernel.org, trivial@kernel.org References: <1492720999.3041.18.camel@redhat.com> <86425035-7da8-d2b1-8544-d4f7540d50c6@users.sourceforge.net> Message-ID: Date: Sat, 22 Apr 2017 16:43:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: <86425035-7da8-d2b1-8544-d4f7540d50c6@users.sourceforge.net> Content-Language: en-GB X-Provags-ID: V03:K0:VmqH2CYAwDIMzdqj1lqGeM0mgDxvXgqMYqdGhFtSuKK/MUaKzYT ddToAj0kYoqqRLd6KasYztaqLoAYU+MxEjAtaNDWvI2uxypLqDe0yfcPF/twMD7xxoW/Dg6 aSC7m1aOvS6W68L3OOy312JNiQ/NEjOBAPyAyGjebiD+bQtJUtqttZ2FhCl1Hz76VZe4H6C 1HltsJ7BekhAr5zWByuRA== X-UI-Out-Filterresults: notjunk:1; V01:K0:SXgzKcJ/NJE=:SwgtDXz8l1cPmyjj9E9hfB RcrpX3laK0J12mZU4nyOwdbcfT52jNN3YI5rM2haCZ0F4whXXbmPYg34v9811EQjqK4gwL8RF 2oizArPWIBwXzjJ6AAFu6ZoxIUapURnZlTanbKWDcKqlU7IbavyRYpw0PJjfv9Dp/XuL6wspc ToGG4isKCf1n6JlKARWt+PlI59Ah7nv+vFeNSqskLHo1XrDUvBdZEKmC7BbbC/YJ8ZFs10oE+ O7QDrvJjj36msgTe8psnF2inuzKl1TxwyneOn41dVb+F3DIzDOLoIkuBlv1c3QaBBFm/JV8Uc lzO4/zyBEqRr0+dQPcRJAwtFSWu1GTKVE+nEHQ8uwjd7rJJj2ea85DbVvnx8HPaSbKdjsADGY vKl4qX+AbaYprnhs0pPSK88ULphzfs9p42oVhZk/8dn9XiMUM3GPVHeFddIIOd+mXs0OpivJN UD4m9ZT621iscqCPCH5q6AH1I3m9OLN3nkcXTISusXQKL3oyYqJZbKnf8S6i93ti01pYUXqNv VwRhBhHdL+1mYwkpgi3qkZqle5NJCFQvsytYpdaVhg5Tkd/JSCb06OAsQipxnXMpsv8AWOlnm VxtNCP4xVNSZ/YhsJN7PHARKUcaCnBKc+rA1rcuRRxXkawanKsD/mjtNH5Ff9yJ+QTsK5eXiv iL2xlx5LOcYPEYEtiK8jgrf4H8qXCfzEJ5iL6LmLtPQxkarls1Xk427myDmZB0nEF1NgYkpTG o3J+3M7HuCOCVJOE/82HXM8oOjrRtfZNGr+bUQ1BWNJWiu2pA7uXf3SjT/ok1dxBm7SBPcGtf jpkJFRJ 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 From: Markus Elfring Date: Sat, 22 Apr 2017 13:54:28 +0200 Do not use curly brackets at some source code places where a single statement should be sufficient. Signed-off-by: Markus Elfring --- v2: Changes were rebased on source files from Linux next-20170421. These were recombined as requested by Doug Ledford. drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 17 ++++++------ drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 41 +++++++++++------------------ 2 files changed, 24 insertions(+), 34 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index aa32bc9f323d..d5b988b011d1 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -1092,14 +1092,14 @@ static int ocrdma_mbx_cmd(struct ocrdma_dev *dev, struct ocrdma_mqe *mqe) if (cqe_status || ext_status) { pr_err("%s() cqe_status=0x%x, ext_status=0x%x,", __func__, cqe_status, ext_status); - if (rsp) { + if (rsp) /* This is for embedded cmds. */ pr_err("opcode=0x%x, subsystem=0x%x\n", (rsp->subsys_op & OCRDMA_MBX_RSP_OPCODE_MASK) >> OCRDMA_MBX_RSP_OPCODE_SHIFT, (rsp->subsys_op & OCRDMA_MBX_RSP_SUBSYS_MASK) >> OCRDMA_MBX_RSP_SUBSYS_SHIFT); - } + status = ocrdma_get_mbx_cqe_errno(cqe_status); goto mbx_err; } @@ -1600,10 +1600,9 @@ void ocrdma_alloc_pd_pool(struct ocrdma_dev *dev) return; status = ocrdma_mbx_alloc_pd_range(dev); - if (status) { + if (status) pr_err("%s(%d) Unable to initialize PD pool, using default.\n", __func__, dev->id); - } } static void ocrdma_free_pd_pool(struct ocrdma_dev *dev) @@ -2997,11 +2996,10 @@ static int ocrdma_parse_dcbxcfg_rsp(struct ocrdma_dev *dev, int ptype, goto out; } } - if (slindx == OCRDMA_MAX_SERVICE_LEVEL_INDEX) { + if (slindx == OCRDMA_MAX_SERVICE_LEVEL_INDEX) pr_info("%s ocrdma%d application priority not set for 0x%x protocol\n", dev_name(&dev->nic_info.pdev->dev), dev->id, proto); - } } } @@ -3158,16 +3156,17 @@ static int ocrdma_modify_eqd(struct ocrdma_dev *dev, struct ocrdma_eq *eq, int num) { int num_eqs, i = 0; - if (num > 8) { + + if (num > 8) while (num) { num_eqs = min(num, 8); ocrdma_mbx_modify_eqd(dev, &eq[i], num_eqs); i += num_eqs; num -= num_eqs; } - } else { + else ocrdma_mbx_modify_eqd(dev, eq, num); - } + return 0; } diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index f12d1d458f28..16f14d4c3e85 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -504,10 +504,10 @@ static int ocrdma_dealloc_ucontext_pd(struct ocrdma_ucontext *uctx) struct ocrdma_pd *pd = uctx->cntxt_pd; struct ocrdma_dev *dev = get_ocrdma_dev(pd->ibpd.device); - if (uctx->pd_in_use) { + if (uctx->pd_in_use) pr_err("%s(%d) Freeing in use pdid=0x%x.\n", __func__, dev->id, pd->id); - } + uctx->cntxt_pd = NULL; (void)_ocrdma_dealloc_pd(dev, pd); return 0; @@ -741,11 +741,10 @@ struct ib_pd *ocrdma_alloc_pd(struct ib_device *ibdev, return &pd->ibpd; err: - if (is_uctx_pd) { + if (is_uctx_pd) ocrdma_release_ucontext_pd(uctx); - } else { + else status = _ocrdma_dealloc_pd(dev, pd); - } exit: return ERR_PTR(status); } @@ -1022,10 +1021,10 @@ int ocrdma_dereg_mr(struct ib_mr *ib_mr) kfree(mr); /* Don't stop cleanup, in case FW is unresponsive */ - if (dev->mqe_ctx.fw_error_state) { + if (dev->mqe_ctx.fw_error_state) pr_err("%s(%d) fw not responding.\n", __func__, dev->id); - } + return 0; } @@ -1417,10 +1416,10 @@ struct ib_qp *ocrdma_create_qp(struct ib_pd *ibpd, goto gen_err; memset(&ureq, 0, sizeof(ureq)); - if (udata) { + if (udata) if (ib_copy_from_udata(&ureq, udata, sizeof(ureq))) return ERR_PTR(-EFAULT); - } + qp = kzalloc(sizeof(*qp), GFP_KERNEL); if (!qp) { status = -ENOMEM; @@ -2835,15 +2834,11 @@ static bool ocrdma_poll_rcqe(struct ocrdma_qp *qp, struct ocrdma_cqe *cqe, bool expand = false; ibwc->wc_flags = 0; - if (qp->qp_type == IB_QPT_UD || qp->qp_type == IB_QPT_GSI) { - status = (le32_to_cpu(cqe->flags_status_srcqpn) & - OCRDMA_CQE_UD_STATUS_MASK) >> - OCRDMA_CQE_UD_STATUS_SHIFT; - } else { - status = (le32_to_cpu(cqe->flags_status_srcqpn) & - OCRDMA_CQE_STATUS_MASK) >> OCRDMA_CQE_STATUS_SHIFT; - } - + status = (qp->qp_type == IB_QPT_UD || qp->qp_type == IB_QPT_GSI) + ? ((le32_to_cpu(cqe->flags_status_srcqpn) & + OCRDMA_CQE_UD_STATUS_MASK) >> OCRDMA_CQE_UD_STATUS_SHIFT) + : ((le32_to_cpu(cqe->flags_status_srcqpn) & + OCRDMA_CQE_STATUS_MASK) >> OCRDMA_CQE_STATUS_SHIFT); if (status == OCRDMA_CQE_SUCCESS) { *polled = true; ocrdma_poll_success_rcqe(qp, cqe, ibwc); @@ -2891,13 +2886,9 @@ static int ocrdma_poll_hwcq(struct ocrdma_cq *cq, int num_entries, qp = dev->qp_tbl[qpn]; BUG_ON(qp == NULL); - if (is_cqe_for_sq(cqe)) { - expand = ocrdma_poll_scqe(qp, cqe, ibwc, &polled, - &stop); - } else { - expand = ocrdma_poll_rcqe(qp, cqe, ibwc, &polled, - &stop); - } + expand = is_cqe_for_sq(cqe) + ? ocrdma_poll_scqe(qp, cqe, ibwc, &polled, &stop) + : ocrdma_poll_rcqe(qp, cqe, ibwc, &polled, &stop); if (expand) goto expand_cqe; if (stop)