From patchwork Wed Sep 20 11:54:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 9961341 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 017DE60234 for ; Wed, 20 Sep 2017 11:54:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E861D290BC for ; Wed, 20 Sep 2017 11:54:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD2D7290DA; Wed, 20 Sep 2017 11:54:48 +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 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 6DBAA290BC for ; Wed, 20 Sep 2017 11:54:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751848AbdITLyr (ORCPT ); Wed, 20 Sep 2017 07:54:47 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:49191 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751845AbdITLyr (ORCPT ); Wed, 20 Sep 2017 07:54:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=h/OF1Cfp5yg4EuzGbIt2I8MWaKuqQEpkGchEAuOmEuw=; b=cVQrtUlmsE7IBKQs2GjjO2UZe xE7C4OV6Dwv0wx/TUQYP7iJ0LgScArIWZlFHmTVYkAL3zsmpm1jw/dCqMlWnmH1vVfCtEQBnsFJIC mssSppx83vuJ6ONuqIEk19XJX6yEY5z+VcmmRBKC++3WlGBuPvJABiGrEOeNWr+xDCt943+s8pFvc zlxh08iqnD2N3WW2swEtvmifcsK4Lq3M3KbzChA08l8PMQGNfdLc+/RTFHu76GeawhbypNMUf5eVo VO2b81w8uGTn1q1ytpu2z8iONp0jBxE4fLsRtQ61bZ6Xvhmyxb8Xoj8NFu6BLyCP/8B12nfGRDPta G5RmJwHYg==; Received: from bzq-82-81-101-184.red.bezeqint.net ([82.81.101.184] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1dudaY-00059w-AQ; Wed, 20 Sep 2017 11:54:46 +0000 From: Sagi Grimberg To: Doug Ledford Cc: linux-rdma@vger.kernel.org Subject: [PATCH v2] rdma/core: Don't dereference device->get_link_layer directly Date: Wed, 20 Sep 2017 14:54:43 +0300 Message-Id: <1505908483-29641-1-git-send-email-sagi@grimberg.me> X-Mailer: git-send-email 2.7.4 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 We have rdma_port_get_link_layer that checks the callout is actually implemented. Signed-off-by: Sagi Grimberg --- Changes from v1: - fixed typo drivers/infiniband/core/verbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index ee9e27dc799b..de57d6c11a25 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1646,7 +1646,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid) */ if (!ib_query_qp(qp, &attr, IB_QP_STATE | IB_QP_PORT, &init_attr)) { if (attr.qp_state >= IB_QPS_INIT) { - if (qp->device->get_link_layer(qp->device, attr.port_num) != + if (rdma_port_get_link_layer(qp->device, attr.port_num) != IB_LINK_LAYER_INFINIBAND) return true; goto lid_check; @@ -1655,7 +1655,7 @@ static bool is_valid_mcast_lid(struct ib_qp *qp, u16 lid) /* Can't get a quick answer, iterate over all ports */ for (port = 0; port < qp->device->phys_port_cnt; port++) - if (qp->device->get_link_layer(qp->device, port) != + if (rdma_port_get_link_layer(qp->device, port) != IB_LINK_LAYER_INFINIBAND) num_eth_ports++;