From patchwork Wed Jan 24 12:43:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuval Shaia X-Patchwork-Id: 10182437 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 BBF7A60233 for ; Wed, 24 Jan 2018 12:44:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7B5C288B9 for ; Wed, 24 Jan 2018 12:44:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC8E0288CF; Wed, 24 Jan 2018 12:44:38 +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_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY 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 29353288B9 for ; Wed, 24 Jan 2018 12:44:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933654AbeAXMoe (ORCPT ); Wed, 24 Jan 2018 07:44:34 -0500 Received: from userp2130.oracle.com ([156.151.31.86]:52572 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933648AbeAXMoc (ORCPT ); Wed, 24 Jan 2018 07:44:32 -0500 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w0OCgDDm109367; Wed, 24 Jan 2018 12:43:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=cgYWsbWvN0AsFSYKzDlFeK3vqWuhBkvLak86EKllaWU=; b=TyI4qsw5jv1MkuWUf77m4DKJuqpa+795uO1i4lX3dCGI/u0UOgbORRz7otKGBICSQtnn DKHWqrnrBO5CK42TCeFmgCf7kKoPXfHL+tRxEXpeGFkIp5jfsVIIs+izgrj/QsV3soSf j8oQqDTZPz2qr9dwcwtlmbQGBNXgEael9kbW8YxbfX7kWlnCnGQ59OuWx9uEZTYo0zYl Tc/ZP3E5MwKxy701cCCJrAqkeeuE41pGYJ1PTbSLjJXdwGu1Q5V76FCv3Yr2bMFOs3Vh mNRLSrymE93gb+mUZLdbV1kNeqXnpwZ8YfGgR73c39xcsHJn5sQFERurHVnwny0q+lJy zw== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2130.oracle.com with ESMTP id 2fpsd988cn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 24 Jan 2018 12:43:17 +0000 Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w0OChGe8012259 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 24 Jan 2018 12:43:16 GMT Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w0OChFkW001067; Wed, 24 Jan 2018 12:43:15 GMT Received: from localhost.localdomain (/77.138.186.148) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 24 Jan 2018 04:43:14 -0800 From: Yuval Shaia To: aditr@vmware.com, pv-drivers@vmware.com, dledford@redhat.com, jgg@ziepe.ca, jgg@mellanox.com, ogerlitz@mellanox.com, sagi@grimberg.me, roid@mellanox.com, bart.vanassche@sandisk.com, hare@suse.com, nab@linux-iscsi.org, linux-rdma@vger.kernel.org Cc: Yuval Shaia Subject: [PATCH v2] RDMA: Use standard way to check return value Date: Wed, 24 Jan 2018 14:43:01 +0200 Message-Id: <20180124124301.10884-1-yuval.shaia@oracle.com> X-Mailer: git-send-email 2.14.3 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8783 signatures=668655 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=763 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1801240171 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 To be compatible with other modules/drivers, change return code checks from "if (rc != 0)" to "if (rc)". Signed-off-by: Yuval Shaia Reviewed-by: Leon Romanovsky --- v0 -> v1: * Add some other fixes (srp,iser and srpt) v1 -> v2: * Accept Leon's comment and change commit's title. --- drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 8 ++++---- drivers/infiniband/ulp/iser/iser_initiator.c | 2 +- drivers/infiniband/ulp/srp/ib_srp.c | 2 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c index d650a9fcde24..ce289a55a9dc 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c @@ -837,16 +837,16 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, } /* Enable 64-Bit DMA */ - if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) == 0) { + if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(64))) { ret = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); - if (ret != 0) { + if (ret) { dev_err(&pdev->dev, "pci_set_consistent_dma_mask failed\n"); goto err_free_resource; } } else { ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); - if (ret != 0) { + if (ret) { dev_err(&pdev->dev, "pci_set_dma_mask failed\n"); goto err_free_resource; @@ -1018,7 +1018,7 @@ static int pvrdma_pci_probe(struct pci_dev *pdev, /* Check if device was successfully activated */ ret = pvrdma_read_reg(dev, PVRDMA_REG_ERR); - if (ret != 0) { + if (ret) { dev_err(&pdev->dev, "failed to activate device\n"); ret = -EFAULT; goto err_disable_intr; diff --git a/drivers/infiniband/ulp/iser/iser_initiator.c b/drivers/infiniband/ulp/iser/iser_initiator.c index 2a07692007bd..09045a432f89 100644 --- a/drivers/infiniband/ulp/iser/iser_initiator.c +++ b/drivers/infiniband/ulp/iser/iser_initiator.c @@ -128,7 +128,7 @@ iser_prepare_write_cmd(struct iscsi_task *task, err = iser_reg_rdma_mem(iser_task, ISER_DIR_OUT, buf_out->data_len == imm_sz); - if (err != 0) { + if (err) { iser_err("Failed to register write cmd RDMA mem\n"); return err; } diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 62d88212c1b0..8d9676b9fbc9 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -2109,7 +2109,7 @@ static void srp_recv_done(struct ib_cq *cq, struct ib_wc *wc) DMA_FROM_DEVICE); res = srp_post_recv(ch, iu); - if (res != 0) + if (res) shost_printk(KERN_ERR, target->scsi_host, PFX "Recv failed with error code %d\n", res); } diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c index d78f60dcc2ba..659e6d62fb97 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -1441,7 +1441,7 @@ static void srpt_handle_cmd(struct srpt_rdma_ch *ch, scsilun_to_int(&srp_cmd->lun), data_len, TCM_SIMPLE_TAG, dir, TARGET_SCF_ACK_KREF, sg, sg_cnt, NULL, 0, NULL, 0); - if (rc != 0) { + if (rc) { pr_debug("target_submit_cmd() returned %d for tag %#llx\n", rc, srp_cmd->tag); goto release_ioctx; @@ -1508,7 +1508,7 @@ static void srpt_handle_tsk_mgmt(struct srpt_rdma_ch *ch, scsilun_to_int(&srp_tsk->lun), srp_tsk, tcm_tmr, GFP_KERNEL, srp_tsk->task_tag, TARGET_SCF_ACK_KREF); - if (rc != 0) { + if (rc) { send_ioctx->cmd.se_tmr_req->response = TMR_FUNCTION_REJECTED; goto fail; }