From patchwork Thu Aug 17 14:58:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 9906541 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 5DD2B60386 for ; Thu, 17 Aug 2017 15:00:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E31028B52 for ; Thu, 17 Aug 2017 15:00:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42E3528B51; Thu, 17 Aug 2017 15:00:45 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 A700328B64 for ; Thu, 17 Aug 2017 15:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbdHQPAn (ORCPT ); Thu, 17 Aug 2017 11:00:43 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:37735 "EHLO mail-wr0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751620AbdHQPAm (ORCPT ); Thu, 17 Aug 2017 11:00:42 -0400 Received: by mail-wr0-f177.google.com with SMTP id z91so37298470wrc.4 for ; Thu, 17 Aug 2017 08:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=oaabzUyxuz0YGc/Gt5xftEu3MMX2kL/rFd7YjQUKUOE=; b=MyUVanZbfBnhRb6nV3YLEbM+dsZ0mQXkKrACJxsr+j73BMpxXnnAjZTYt/jbo58GA/ wC1g4zihswziej7zNDi1csit+HllRyIb/VHYPOirMIMHsUmf5WwScWGIkqhebHhOn7Zn Xq/osC3JwQ4lR9n/Z2VSMOw0WFDjEd9orx898= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oaabzUyxuz0YGc/Gt5xftEu3MMX2kL/rFd7YjQUKUOE=; b=DqAKWs5XWnCGWpZlWPwsEommEN5LCZ8KgxnRe3kOj6RJ7QIRXg2hrQjGR47m2IwhEX sX7vtuXZBo8/DbrPCfWGfWWpR8a79kBjxeRhaDBHKI3bSDGUId/mBV7kbRm/yFo7FlY+ j7LG/VHkLU3m9Kflwt5058lgaTlNxWzsSOzxijaueOi10BThgTLoT571db1lj/XuuxAJ 76w3nEVb8X9RSuRV6zfzM1XE4P56THuGLO0HdFs/uqzSIWMsXd4fCiNmWjPswQZnFjD7 fE4poLA1yeNhNI9yhYPCO9+wWZRWbBmLQ8Mr//vwLGi2V5FP4SL/4ZkdInzZxyvl1nro xFNQ== X-Gm-Message-State: AHYfb5iqO2aRpd7MSaorNIEmHHp1TjoFIlkOFFsMst8/tsOYIfWiCuxx WYk6BqhKxxyLjUl8 X-Received: by 10.28.99.11 with SMTP id x11mr1370556wmb.164.1502982040069; Thu, 17 Aug 2017 08:00:40 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net ([192.19.239.250]) by smtp.gmail.com with ESMTPSA id b186sm3143918wma.24.2017.08.17.08.00.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Aug 2017 08:00:38 -0700 (PDT) From: Selvin Xavier To: dledford@redhat.com Cc: linux-rdma@vger.kernel.org, Selvin Xavier Subject: [PATCH v2 for-next] RDMA: Fix return value check for ib_get_eth_speed() Date: Thu, 17 Aug 2017 07:58:07 -0700 Message-Id: <1502981887-31953-1-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 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 ib_get_eth_speed() return 0 on success. Fixing the condition checking and prevent reporting failure for query_port verb. Fixes: d41861942fc5 ("Add generic function to extract IB speed from netdev") Signed-off-by: Selvin Xavier Reviewed-by: Leon Romanovsky Reviewed-by: Yuval Shaia --- v1 -> v2: Fixing the commit log. Also, fixes the same issue in usnic driver also drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++-- drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c index d78fedc..3fa20e0 100644 --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c @@ -264,8 +264,8 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, * IB stack to avoid race in the NETDEV_UNREG path */ if (test_bit(BNXT_RE_FLAG_IBDEV_REGISTERED, &rdev->flags)) - if (!ib_get_eth_speed(ibdev, port_num, &port_attr->active_speed, - &port_attr->active_width)) + if (ib_get_eth_speed(ibdev, port_num, &port_attr->active_speed, + &port_attr->active_width)) return -EINVAL; return 0; } diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c index e5f57dd..97dd79e 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c @@ -309,8 +309,8 @@ int usnic_ib_query_port(struct ib_device *ibdev, u8 port, usnic_dbg("\n"); mutex_lock(&us_ibdev->usdev_lock); - if (!ib_get_eth_speed(ibdev, port, &props->active_speed, - &props->active_width)) { + if (ib_get_eth_speed(ibdev, port, &props->active_speed, + &props->active_width)) { mutex_unlock(&us_ibdev->usdev_lock); return -EINVAL; }