]> git.openfabrics.org - ~shefty/libibverbs.git/commitdiff
Set ibv_device->node_type when allocating device
authorswelch@systemfabricworks.com <swelch@systemfabricworks.com>
Fri, 31 Aug 2007 16:30:51 +0000 (11:30 -0500)
committerRoland Dreier <rolandd@cisco.com>
Tue, 9 Oct 2007 20:08:48 +0000 (13:08 -0700)
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>
src/init.c

index a8bebd27a51186b2bec6406baef70df0da9c27b2..07ab855f803e481ae968db53f84caaa0acc0d4ba 100644 (file)
@@ -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: