RDMA/device: Call ib_cache_release_one() only from ib_device_release()
authorJason Gunthorpe <jgg@mellanox.com>
Thu, 7 Feb 2019 05:41:49 +0000 (22:41 -0700)
committerJason Gunthorpe <jgg@mellanox.com>
Fri, 8 Feb 2019 23:56:45 +0000 (16:56 -0700)
commitd45f89d59bcd42d6b8575d0af69d7a3a98e73bb6
tree7e2eab55760501c53c2ac750bb65e74cdd0a6026
parentb34b269ad85d7dd4a512487f2395c3be3e40f76a
RDMA/device: Call ib_cache_release_one() only from ib_device_release()

Instead of complicated logic about when this memory is freed, always free
it during device release(). All the cache pointers start out as NULL, so
it is safe to call this before the cache is initialized.

This makes for a simpler error unwind flow, and a simpler understanding of
the lifetime of the memory allocations inside the struct ib_device.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cache.c
drivers/infiniband/core/device.c