From patchwork Sat May 17 18:23:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Senna Tschudin X-Patchwork-Id: 4196951 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31FB9BEEAB for ; Sat, 17 May 2014 18:24:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66D2A203AD for ; Sat, 17 May 2014 18:24:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5D9612039C for ; Sat, 17 May 2014 18:24:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030390AbaEQSYd (ORCPT ); Sat, 17 May 2014 14:24:33 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:48431 "EHLO mail-wg0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030236AbaEQSYb (ORCPT ); Sat, 17 May 2014 14:24:31 -0400 Received: by mail-wg0-f45.google.com with SMTP id m15so6370939wgh.16 for ; Sat, 17 May 2014 11:24:30 -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=DhM1JceEWOfR7TTm5sboGgeB3yI5rIrK9eosIOuwwsA=; b=mYL45pZNIpx3LNE7+hUDH/FSKVgW0uMi6p2ZBibVtMMqRA8TetGtvijW4wkv6Fei3v E+dtGGHxRrthnMrny9y7p7SCkxsg3lP8YPNWijrdLlRRPOfV10hXxJHm9JZtKll6WXeE q6iNOdNUAFNuYsslZW7tSAklHpqKZSWsB4Kp0zVBief+jmc+sbO9EpGB0epVJ8Y2EkPd jPb+7sifcg97ZPwONVdZ6vkqXth6axlRhjKa6vzXqR2dfi7XW7LcVLSX810K4fndMRIa GBFL4Pcryq9RGs3oBat0SS/XHo+NOyFhw4n6XQ5ptSiLY6P+dQgzxRp/staRGNmXjKh5 bmyw== X-Received: by 10.180.78.5 with SMTP id x5mr4350801wiw.12.1400351070215; Sat, 17 May 2014 11:24:30 -0700 (PDT) Received: from localhost.localdomain (toshiba-peter.rsr.lip6.fr. [132.227.76.134]) by mx.google.com with ESMTPSA id fu10sm5034939wib.11.2014.05.17.11.24.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 May 2014 11:24:29 -0700 (PDT) From: Peter Senna Tschudin To: Roland Dreier Cc: Peter Senna Tschudin , Sean Hefty , Hal Rosenstock , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 4/4] IB: Remove redundant error check Date: Sat, 17 May 2014 20:23:00 +0200 Message-Id: <1400350980-30455-4-git-send-email-peter.senna@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove double checks, and move calls to pr_err and printk to the first check. The simplified version of the coccinelle semantic patch that fixes this issue is as follows: // @@ expression E; identifier pr; expression list es; @@ for(...;...;...){ ... - if (E) break; + if (E){ + pr(es); + break; + } ... } - if(E) pr(es); // Tested by compilation only. Signed-off-by: Peter Senna Tschudin --- drivers/infiniband/hw/ocrdma/ocrdma_hw.c | 6 +++--- drivers/infiniband/ulp/srpt/ib_srpt.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c index 3bbf201..f085a51 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -1839,11 +1839,11 @@ int ocrdma_reg_mr(struct ocrdma_dev *dev, status = ocrdma_mbx_reg_mr_cont(dev, hwmr, cur_pbl_cnt, pbl_offset, last); - if (status) + if (status) { + pr_err("%s() err. status=%d\n", __func__, status); break; + } } - if (status) - pr_err("%s() err. status=%d\n", __func__, status); return status; } diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index fe09f27..ab23b07 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -2875,13 +2875,13 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, wr.send_flags = IB_SEND_SIGNALED; ret = ib_post_send(ch->qp, &wr, &bad_wr); - if (ret) + if (ret) { + printk(KERN_ERR "%s[%d]: ib_post_send() returned %d for %d/%d", + __func__, __LINE__, ret, i, n_rdma); break; + } } - if (ret) - printk(KERN_ERR "%s[%d]: ib_post_send() returned %d for %d/%d", - __func__, __LINE__, ret, i, n_rdma); if (ret && i > 0) { wr.num_sge = 0; wr.wr_id = encode_wr_id(SRPT_RDMA_ABORT, ioctx->ioctx.index);