From patchwork Fri Feb 22 15:34:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 2176351 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 1F0DA3FD4E for ; Fri, 22 Feb 2013 15:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757196Ab3BVPeu (ORCPT ); Fri, 22 Feb 2013 10:34:50 -0500 Received: from mail-bk0-f43.google.com ([209.85.214.43]:61810 "EHLO mail-bk0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756947Ab3BVPeu (ORCPT ); Fri, 22 Feb 2013 10:34:50 -0500 Received: by mail-bk0-f43.google.com with SMTP id jm19so352482bkc.30 for ; Fri, 22 Feb 2013 07:34:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:content-transfer-encoding:x-gm-message-state; bh=tUXSl1S9vndb+yEIBAG7Jsh7ezdT2DlrDzDiS4NK6SQ=; b=l7dyrsGGWYyiDvUbQBAemgl5rNXoL2bbw+szjfZY1twI4X3mE9am5sRJs4h6pP4Soy aHxUUb5dbYT1EJBNoW3RoBYhqPrewjbOt+cxtSCn6kRuBSK2gv1xjkkou8Gy6R9Frwri esL0X9xLUpvodpsMJLFS0o/AByAVjXaMavsPNtZhzbUgS7x3RrLSWi2Nx0ljF73i/WXB 4XveERE2dlpG/EXOiPs+ImJAsDqhqRRlkLMj9lY+LUDXJgxLVsd4WOUFIVOwCBpP4jZe MYqgWri2kLshbIY1nJFl+ak4xdG23KE/OaA9qmKgBeyzzbVElBZtsk2SRi0Vyad7mieE QXaQ== X-Received: by 10.204.147.216 with SMTP id m24mr1226906bkv.77.1361547288220; Fri, 22 Feb 2013 07:34:48 -0800 (PST) Received: from [192.168.1.102] (c-71-234-225-85.hsd1.ct.comcast.net. [71.234.225.85]) by mx.google.com with ESMTPS id fy17sm758468bkc.6.2013.02.22.07.34.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 22 Feb 2013 07:34:47 -0800 (PST) Message-ID: <51279015.10105@dev.mellanox.co.il> Date: Fri, 22 Feb 2013 10:34:45 -0500 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Alex Netes Subject: [PATCH] opensm/osm_req.c: Better implementation of req_determine_mkey X-Gm-Message-State: ALoCoQk6QLcxfXjbo7GgsFfS2Rz14SV64x0sgQtfXrePMc9irIKylB0/hTLh0vBWZ28xh0+n4aNE Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Eliminate compile warning: osm_req.c: In function â??req_determine_mkeyâ??: osm_req.c:69: warning: â??p_nodeâ?? may be used uninitialized in this function Signed-off-by: Alex Netes --- -- 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/opensm/osm_req.c b/opensm/osm_req.c index f9ffc81..e0634e0 100644 --- a/opensm/osm_req.c +++ b/opensm/osm_req.c @@ -80,31 +80,27 @@ static ib_net64_t req_determine_mkey(IN osm_sm_t * sm, /* hop_count == 0: destination port guid is SM */ if (p_path->hop_count == 0) { - if (p_sm_port != NULL) - dest_port_guid = sm->p_subn->sm_port_guid; - else - dest_port_guid = sm->p_subn->opt.guid; + dest_port_guid = sm->p_subn->sm_port_guid; goto Remote_Guid; } if (p_sm_port) { - /* get the node for the SM */ p_node = p_sm_port->p_node; - p_physp = p_sm_port->p_physp; + if (osm_node_get_type(p_node) == IB_NODE_TYPE_SWITCH) + p_physp = osm_node_get_physp_ptr(p_node, p_path->path[1]); + else + p_physp = p_sm_port->p_physp; } - for (hop = 1; p_physp && hop < p_path->hop_count; hop++) { - p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]); + /* hop_count == 1: outgoing physp is SM physp */ + for (hop = 2; p_physp && hop <= p_path->hop_count; hop++) { + p_physp = p_physp->p_remote_physp; if (!p_physp) break; - p_physp = osm_physp_get_remote(p_physp); - if (!p_physp) - break; - p_node = osm_physp_get_node_ptr(p_physp); + p_node = p_physp->p_node; + p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]); } - p_physp = osm_node_get_physp_ptr(p_node, p_path->path[hop]); - /* At this point, p_physp points at the outgoing physp on the last hop, or NULL if we don't know it. */