diff mbox series

[net-next,v2] et131x: Remove NULL check of list_entry()

Message ID 20240823012737.2995688-1-liyuesong@vivo.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [net-next,v2] et131x: Remove NULL check of list_entry() | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 3 maintainers not CCed: jacob.e.keller@intel.com edumazet@google.com sd@queasysnail.net
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-25--21-00 (tests: 714)

Commit Message

Yuesong Li Aug. 23, 2024, 1:27 a.m. UTC
list_entry() will never return a NULL pointer, thus remove the
check.

Signed-off-by: Yuesong Li <liyuesong@vivo.com>
Reviewed-by: Mark Einon <mark.einon@gmail.com>
---
changes v2:
- update the short log and patch name
---
 drivers/net/ethernet/agere/et131x.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Simon Horman Aug. 23, 2024, 8:28 a.m. UTC | #1
On Fri, Aug 23, 2024 at 09:27:37AM +0800, Yuesong Li wrote:
> list_entry() will never return a NULL pointer, thus remove the
> check.
> 
> Signed-off-by: Yuesong Li <liyuesong@vivo.com>
> Reviewed-by: Mark Einon <mark.einon@gmail.com>
> ---
> changes v2:
> - update the short log and patch name

Thanks for the update.

Reviewed-by: Simon Horman <horms@kernel.org>
Jakub Kicinski Aug. 26, 2024, 8:27 p.m. UTC | #2
On Fri, 23 Aug 2024 09:27:37 +0800 Yuesong Li wrote:
> list_entry() will never return a NULL pointer, thus remove the
> check.

Unclear to me whether the intent of this code is to check for empty
list or this is defensive programming. Let's leave it be.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/agere/et131x.c b/drivers/net/ethernet/agere/et131x.c
index b325e0cef120..74fc55b9f0d9 100644
--- a/drivers/net/ethernet/agere/et131x.c
+++ b/drivers/net/ethernet/agere/et131x.c
@@ -2244,11 +2244,6 @@  static struct rfd *nic_rx_pkts(struct et131x_adapter *adapter)
 	element = rx_local->recv_list.next;
 	rfd = list_entry(element, struct rfd, list_node);
 
-	if (!rfd) {
-		spin_unlock_irqrestore(&adapter->rcv_lock, flags);
-		return NULL;
-	}
-
 	list_del(&rfd->list_node);
 	rx_local->num_ready_recv--;