Commit 31d14b6e authored by Alexander Chiang's avatar Alexander Chiang Committed by Roland Dreier

IB/ucm: Use stack variable 'base' in ib_ucm_add_one

This change is not useful by itself, but sets us up for a future
change that allows us to support more than IB_UCM_MAX_DEVICES.
Signed-off-by: default avatarAlex Chiang <achiang@hp.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent dd08f702
...@@ -1240,6 +1240,7 @@ static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); ...@@ -1240,6 +1240,7 @@ static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL);
static void ib_ucm_add_one(struct ib_device *device) static void ib_ucm_add_one(struct ib_device *device)
{ {
int devnum; int devnum;
dev_t base;
struct ib_ucm_device *ucm_dev; struct ib_ucm_device *ucm_dev;
if (!device->alloc_ucontext || if (!device->alloc_ucontext ||
...@@ -1257,12 +1258,13 @@ static void ib_ucm_add_one(struct ib_device *device) ...@@ -1257,12 +1258,13 @@ static void ib_ucm_add_one(struct ib_device *device)
goto err; goto err;
ucm_dev->devnum = devnum; ucm_dev->devnum = devnum;
base = devnum + IB_UCM_BASE_DEV;
set_bit(devnum, dev_map); set_bit(devnum, dev_map);
cdev_init(&ucm_dev->cdev, &ucm_fops); cdev_init(&ucm_dev->cdev, &ucm_fops);
ucm_dev->cdev.owner = THIS_MODULE; ucm_dev->cdev.owner = THIS_MODULE;
kobject_set_name(&ucm_dev->cdev.kobj, "ucm%d", ucm_dev->devnum); kobject_set_name(&ucm_dev->cdev.kobj, "ucm%d", ucm_dev->devnum);
if (cdev_add(&ucm_dev->cdev, IB_UCM_BASE_DEV + devnum, 1)) if (cdev_add(&ucm_dev->cdev, base, 1))
goto err; goto err;
ucm_dev->dev.class = &cm_class; ucm_dev->dev.class = &cm_class;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment