diff options
| author | Maoyi Xie <maoyixie.tju@gmail.com> | 2026-05-26 13:46:53 +0800 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@nvidia.com> | 2026-06-03 15:04:40 -0300 |
| commit | ba7c4912f7abb0e30b920faf86b32ffb9e5e8b14 (patch) | |
| tree | 3e47b94f885066aa5f9a7d5eafa6499501c893a1 /include/linux/objtool_types.h | |
| parent | d6ab440240a04b8737ee4c7bb21af9182e451733 (diff) | |
RDMA/hns: drop dead empty check in setup_root_hem()
setup_root_hem() reads the first entry of head->root and checks
the returned pointer against NULL:
root_hem = list_first_entry(&head->root,
struct hns_roce_hem_item, list);
if (!root_hem)
return -ENOMEM;
list_first_entry() never returns NULL. On an empty list it returns
container_of(head, ..., list), a non-NULL garbage pointer that
aliases the head. So the check is dead.
The only caller adds an entry to head.root right before invoking
setup_root_hem():
list_add(&root_hem->list, &head.root);
ret = setup_root_hem(..., &head, ...);
So head.root is guaranteed non-empty on entry. Drop the check.
Link: https://patch.msgid.link/r/20260526054653.2054800-1-maoyixie.tju@gmail.com
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Maoyi Xie <maoyixie.tju@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'include/linux/objtool_types.h')
0 files changed, 0 insertions, 0 deletions
