From: swelch@systemfabricworks.com Date: Fri, 31 Aug 2007 16:30:51 +0000 (-0500) Subject: Set ibv_device->node_type when allocating device X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=437ec54b06cc5c3ba4ab93485a6c65efa986e3bc;p=~shefty%2Flibibverbs.git Set ibv_device->node_type when allocating device When allocating a device structure, set the node_type member correctly. Signed-off-by: Steve Welch Signed-off-by: Roland Dreier --- 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: