diff options
author | Jason Gunthorpe <jgunthorpe@obsidianresearch.com> | 2015-08-04 15:23:34 -0600 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-08-30 18:08:50 -0400 |
commit | 55aeed06544f675f25aef06a8c47b0b6b8850f4f (patch) | |
tree | b44faef6b5eff332fb0317a6802de01c98b92742 /drivers/infiniband/core/cache.c | |
parent | net/bonding: Export bond_option_active_slave_get_rcu (diff) | |
download | linux-dev-55aeed06544f675f25aef06a8c47b0b6b8850f4f.tar.xz linux-dev-55aeed06544f675f25aef06a8c47b0b6b8850f4f.zip |
IB/core: Make ib_alloc_device init the kobject
This gets rid of the weird in-between state where struct ib_device
was allocated but the kobject didn't work.
Consequently ib_device_release is now guaranteed to be called in
all situations and we needn't duplicate its kfrees on error paths.
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/cache.c')
-rw-r--r-- | drivers/infiniband/core/cache.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/infiniband/core/cache.c b/drivers/infiniband/core/cache.c index c93af66cc091..a6d50258131e 100644 --- a/drivers/infiniband/core/cache.c +++ b/drivers/infiniband/core/cache.c @@ -351,10 +351,10 @@ static void ib_cache_setup_one(struct ib_device *device) rwlock_init(&device->cache.lock); device->cache.pkey_cache = - kmalloc(sizeof *device->cache.pkey_cache * + kzalloc(sizeof *device->cache.pkey_cache * (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); device->cache.gid_cache = - kmalloc(sizeof *device->cache.gid_cache * + kzalloc(sizeof *device->cache.gid_cache * (rdma_end_port(device) - rdma_start_port(device) + 1), GFP_KERNEL); device->cache.lmc_cache = kmalloc(sizeof *device->cache.lmc_cache * @@ -369,11 +369,8 @@ static void ib_cache_setup_one(struct ib_device *device) goto err; } - for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p) { - device->cache.pkey_cache[p] = NULL; - device->cache.gid_cache [p] = NULL; + for (p = 0; p <= rdma_end_port(device) - rdma_start_port(device); ++p) ib_cache_update(device, p + rdma_start_port(device)); - } INIT_IB_EVENT_HANDLER(&device->cache.event_handler, device, ib_cache_event); |