aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorswelch@systemfabricworks.com <swelch@systemfabricworks.com>2007-08-31 11:30:51 -0500
committerRoland Dreier <rolandd@cisco.com>2007-10-09 13:08:48 -0700
commit437ec54b06cc5c3ba4ab93485a6c65efa986e3bc (patch)
treeca05467536e348113ff1ac888ce03cfca9a4cb53
parentd5052fa0bf8180be9edf1c4c1c014dde01f8a4dd (diff)
downloadlibibverbs-437ec54b06cc5c3ba4ab93485a6c65efa986e3bc.tar.gz
Set ibv_device->node_type when allocating device
When allocating a device structure, set the node_type member correctly. Signed-off-by: Steve Welch <swelch@systemfabricworks.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--src/init.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/init.c b/src/init.c
index a8bebd2..07ab855 100644
--- a/src/init.c
+++ b/src/init.c
@@ -333,7 +333,6 @@ static struct ibv_device *try_driver(struct ibv_driver *driver,
{
struct ibv_device *dev;
char value[8];
- enum ibv_node_type node_type;
dev = driver->init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
if (!dev)
@@ -342,14 +341,14 @@ static struct ibv_device *try_driver(struct ibv_driver *driver,
if (ibv_read_sysfs_file(sysfs_dev->ibdev_path, "node_type", value, sizeof value) < 0) {
fprintf(stderr, PFX "Warning: no node_type attr under %s.\n",
sysfs_dev->ibdev_path);
- node_type = IBV_NODE_UNKNOWN;
+ dev->node_type = IBV_NODE_UNKNOWN;
} else {
- node_type = strtol(value, NULL, 10);
- if (node_type < IBV_NODE_CA || node_type > IBV_NODE_RNIC)
- node_type = IBV_NODE_UNKNOWN;
+ dev->node_type = strtol(value, NULL, 10);
+ if (dev->node_type < IBV_NODE_CA || dev->node_type > IBV_NODE_RNIC)
+ dev->node_type = IBV_NODE_UNKNOWN;
}
- switch (node_type) {
+ switch (dev->node_type) {
case IBV_NODE_CA:
case IBV_NODE_SWITCH:
case IBV_NODE_ROUTER: