From patchwork Sat May 17 21:43:42 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: 4197221 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AD9DC9F32A for ; Sat, 17 May 2014 21:44:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF41B20395 for ; Sat, 17 May 2014 21:44:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1844D20351 for ; Sat, 17 May 2014 21:44:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751497AbaEQVoH (ORCPT ); Sat, 17 May 2014 17:44:07 -0400 Received: from mail-ee0-f52.google.com ([74.125.83.52]:51185 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751452AbaEQVoG (ORCPT ); Sat, 17 May 2014 17:44:06 -0400 Received: by mail-ee0-f52.google.com with SMTP id e53so2470087eek.11 for ; Sat, 17 May 2014 14:44:04 -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=XVe43Mexijxtd2qhjLyk6aB5g+ahJQjlfu60HvWnC1s=; b=wbN/GyGJcUMpVII3LfxDRv7n/vam9i65lbFJUdNPQtqxCHmuHLFoCnmCZrNVRF/ci+ nHJXDZv7P74ZsUIaK3CcktoHoOfpQAnPB5Eg7zO7xsJlK+OD0C0eqnq6WFseEOJiVmhP /K4qf6jASzGJzcG1RYwqSGa64DC/AhIkchUyab/SpNAEyJMUXGKRGe0p7+Ya9YOOw85P m+Le9VIDlb66gqLRcpVKcgAd+zDWnwVkQklNZ7FjyDdZZCFPfLqATUbtKT5owC+cSA1G 0kFww+CSnqg34cjQzyHZiW4Cck4wGA7ckJ0f/t69taqy2nCDtkB681e0T8PhVo1PttLG j03w== X-Received: by 10.14.204.73 with SMTP id g49mr34095222eeo.2.1400363044548; Sat, 17 May 2014 14:44:04 -0700 (PDT) Received: from notepeter.home (210-232.80-90.static-ip.oleane.fr. [90.80.232.210]) by mx.google.com with ESMTPSA id o5sm30038183eeg.8.2014.05.17.14.44.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 May 2014 14:44:03 -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, dan.carpenter@oracle.com Subject: [PATCH 4/4 V2] IB: Remove redundant error check Date: Sat, 17 May 2014 23:43:42 +0200 Message-Id: <1400363022-7632-1-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 --- Changes from V1: - Replaced break with a return - On success return 0 instead of status 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..62c2230 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_hw.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_hw.c @@ -1839,13 +1839,13 @@ int ocrdma_reg_mr(struct ocrdma_dev *dev, status = ocrdma_mbx_reg_mr_cont(dev, hwmr, cur_pbl_cnt, pbl_offset, last); - if (status) - break; + if (status) { + pr_err("%s() err. status=%d\n", __func__, status); + return status; + } } - if (status) - pr_err("%s() err. status=%d\n", __func__, status); - return status; + return 0; } bool ocrdma_is_qp_in_sq_flushlist(struct ocrdma_cq *cq, struct ocrdma_qp *qp) 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);