Skip to content

Commit

Permalink
IB/uverbs: use stack variable 'base' in ib_uverbs_add_one
Browse files Browse the repository at this point in the history
This change is not useful by itself, but sets us up for a future change
that allows us to support more than IB_UVERBS_MAX_DEVICES in a system.

Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Alexander Chiang authored and Roland Dreier committed Feb 24, 2010
1 parent 3870798 commit ddbd688
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ static CLASS_ATTR(abi_version, S_IRUGO, show_abi_version, NULL);
static void ib_uverbs_add_one(struct ib_device *device)
{
int devnum;
dev_t base;
struct ib_uverbs_device *uverbs_dev;

if (!device->alloc_ucontext)
Expand All @@ -750,6 +751,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
goto err;
}
uverbs_dev->devnum = devnum;
base = devnum + IB_UVERBS_BASE_DEV;
set_bit(devnum, dev_map);
spin_unlock(&map_lock);

Expand All @@ -760,7 +762,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
uverbs_dev->cdev.owner = THIS_MODULE;
uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops;
kobject_set_name(&uverbs_dev->cdev.kobj, "uverbs%d", uverbs_dev->devnum);
if (cdev_add(&uverbs_dev->cdev, IB_UVERBS_BASE_DEV + devnum, 1))
if (cdev_add(&uverbs_dev->cdev, base, 1))
goto err_cdev;

uverbs_dev->dev = device_create(uverbs_class, device->dma_device,
Expand Down

0 comments on commit ddbd688

Please sign in to comment.