mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:04:43 +01:00
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>
This commit is contained in:
parent
347afa3904
commit
fbb8bc4080
1 changed files with 0 additions and 9 deletions
|
|
@ -183,9 +183,6 @@ void qed_ooo_release_connection_isles(struct qed_hwfn *p_hwfn,
|
|||
struct qed_ooo_buffer,
|
||||
list_entry);
|
||||
|
||||
if (!p_buffer)
|
||||
break;
|
||||
|
||||
list_move_tail(&p_buffer->list_entry,
|
||||
&p_ooo_info->free_buffers_list);
|
||||
}
|
||||
|
|
@ -218,9 +215,6 @@ void qed_ooo_release_all_isles(struct qed_hwfn *p_hwfn,
|
|||
struct qed_ooo_buffer,
|
||||
list_entry);
|
||||
|
||||
if (!p_buffer)
|
||||
break;
|
||||
|
||||
list_move_tail(&p_buffer->list_entry,
|
||||
&p_ooo_info->free_buffers_list);
|
||||
}
|
||||
|
|
@ -255,9 +249,6 @@ void qed_ooo_free(struct qed_hwfn *p_hwfn)
|
|||
p_buffer = list_first_entry(&p_ooo_info->free_buffers_list,
|
||||
struct qed_ooo_buffer, list_entry);
|
||||
|
||||
if (!p_buffer)
|
||||
break;
|
||||
|
||||
list_del(&p_buffer->list_entry);
|
||||
dma_free_coherent(&p_hwfn->cdev->pdev->dev,
|
||||
p_buffer->rx_buffer_size,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue