]> git.ipfire.org Git - thirdparty/linux.git/commit
net: qed: Remove redundant NULL checks after list_first_entry()
authorZhen Ni <zhen.ni@easystack.cn>
Wed, 24 Sep 2025 03:02:19 +0000 (11:02 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 26 Sep 2025 23:43:11 +0000 (16:43 -0700)
commitfbb8bc408027a94b0b513410df15003e6ba6a77c
tree594c74486333c3d947236c3042cf33f0f5c081f1
parent347afa39042728267550fa7a5ab5e9af52671add
net: qed: Remove redundant NULL checks after list_first_entry()

list_first_entry() never returns NULL — if the list is empty, it still
returns a pointer to an invalid object, leading to potential invalid
memory access when dereferenced.
The calls to list_first_entry() are always guarded by !list_empty(),
which guarantees a valid entry is returned. Therefore, the additional
`if (!p_buffer) break;` checks in qed_ooo_release_connection_isles(),
qed_ooo_release_all_isles(), and qed_ooo_free() are redundant and
unreachable.

Remove the dead code for clarity and consistency with common list
handling patterns in the kernel. No functional change intended.

Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Link: https://patch.msgid.link/20250924030219.1252773-1-zhen.ni@easystack.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/qlogic/qed/qed_ooo.c