netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2] et131x: Remove NULL check of list_entry()
@ 2024-08-23  1:27 Yuesong Li
  2024-08-23  8:28 ` Simon Horman
  2024-08-26 20:27 ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Yuesong Li @ 2024-08-23  1:27 UTC (permalink / raw)
  To: mark.einon, davem, dumazet, kuba, pabeni, horms
  Cc: netdev, linux-kernel, opensource.kernel, Yuesong Li

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(-)

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--;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] et131x: Remove NULL check of list_entry()
  2024-08-23  1:27 [PATCH net-next v2] et131x: Remove NULL check of list_entry() Yuesong Li
@ 2024-08-23  8:28 ` Simon Horman
  2024-08-26 20:27 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2024-08-23  8:28 UTC (permalink / raw)
  To: Yuesong Li
  Cc: mark.einon, davem, dumazet, kuba, pabeni, netdev, linux-kernel,
	opensource.kernel

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>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next v2] et131x: Remove NULL check of list_entry()
  2024-08-23  1:27 [PATCH net-next v2] et131x: Remove NULL check of list_entry() Yuesong Li
  2024-08-23  8:28 ` Simon Horman
@ 2024-08-26 20:27 ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2024-08-26 20:27 UTC (permalink / raw)
  To: Yuesong Li
  Cc: mark.einon, davem, dumazet, pabeni, horms, netdev, linux-kernel,
	opensource.kernel

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.
-- 
pw-bot: reject

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-26 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23  1:27 [PATCH net-next v2] et131x: Remove NULL check of list_entry() Yuesong Li
2024-08-23  8:28 ` Simon Horman
2024-08-26 20:27 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).