path: root/include
diff options
authorJason Gunthorpe <jgg@nvidia.com>2021-06-11 19:00:24 +0300
committerJason Gunthorpe <jgg@nvidia.com>2021-06-16 20:58:29 -0300
commita4676388e2e21215b32f33b42ac5725e315a6680 (patch)
treefdf8ca07541dac4169d5befaeb0e54e2c1bb3469 /include
parentRDMA/core: Split gid_attrs related sysfs from add_port() (diff)
RDMA/core: Simplify how the gid_attrs sysfs is created
Instead of having an whole bunch of different allocations to create the gid_attr kobjects reduce it to three, one for the kobj struct plus the attributes, and one for the attribute list for each of the two groups. Move the freeing of all allocations to the release function. Reorder the operations so all the allocations happen first then the kobject & sysfs operations are last. This removes the majority of the complicated error unwind since the release function will always undo all the memory allocations. Freeing the memory is also much simpler since there is a lot less of it. Consolidate creating the "group of array indexes" pattern into one helper function. Ensure kobject_del is used. Link: https://lore.kernel.org/r/f4149d379db7178d37d11d75e3026bf550f818a1.1623427137.git.leonro@nvidia.com Signed-off-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions