Re: [Intel-wired-lan] [PATCH 38/61] net: Prefer IS_ERR_OR_NULL over manual NULL check

2026-03-12 Thread Przemek Kitszel

On 3/10/26 12:49, Philipp Hahn wrote:

Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL
check.

Change generated with coccinelle.

To: Igor Russkikh 
To: Andrew Lunn 
To: "David S. Miller" 
To: Eric Dumazet 
To: Jakub Kicinski 
To: Paolo Abeni 
To: Pavan Chebbi 
To: Michael Chan 
To: Potnuri Bharat Teja 
To: Tony Nguyen 
To: Przemek Kitszel 
To: Taras Chornyi 
To: Maxime Coquelin 
To: Alexandre Torgue 
To: Iyappan Subramanian 
To: Keyur Chudgar 
To: Quan Nguyen 
To: Heiner Kallweit 
To: Russell King 
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Philipp Hahn 


this is too trivial change, especially when combined like that
https://docs.kernel.org/process/maintainer-netdev.html#clean-up-patches


---
  drivers/net/ethernet/aquantia/atlantic/aq_ring.c| 2 +-
  drivers/net/ethernet/broadcom/tg3.c | 2 +-
  drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c| 3 +--
  drivers/net/ethernet/intel/ice/devlink/devlink.c| 2 +-
  drivers/net/ethernet/marvell/prestera/prestera_router.c | 2 +-
  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c   | 2 +-
  drivers/net/mdio/mdio-xgene.c   | 2 +-
  drivers/net/usb/r8152.c | 2 +-
  8 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c 
b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
index 
e270327e47fd804cc8ee5cfd53ed1b993c955c41..43edef35c4b1ff606b2f1519a07fad4c9a990ad4
 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
@@ -810,7 +810,7 @@ static int __aq_ring_xdp_clean(struct aq_ring_s *rx_ring,
}
  
  		skb = aq_xdp_run_prog(aq_nic, &xdp, rx_ring, buff);

-   if (IS_ERR(skb) || !skb)
+   if (IS_ERR_OR_NULL(skb))
continue;
  
  		if (ptp_hwtstamp_len > 0)

diff --git a/drivers/net/ethernet/broadcom/tg3.c 
b/drivers/net/ethernet/broadcom/tg3.c
index 
2328fce336447eb4a796f9300ccc0ab536ff0a35..8ed79f34f03d81184dcc12e6eaff009cb8f7756e
 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -7943,7 +7943,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct tg3_napi 
*tnapi,
  
  	segs = skb_gso_segment(skb, tp->dev->features &

~(NETIF_F_TSO | NETIF_F_TSO6));
-   if (IS_ERR(segs) || !segs) {
+   if (IS_ERR_OR_NULL(segs)) {
tnapi->tx_dropped++;
goto tg3_tso_bug_end;
}
diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c 
b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
index 
3307e50426819087ad985178c4a5383f16b8e7b4..1c8a6445d4b2e3535d8f1b7908dd02d8dd2f23fa
 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
@@ -1032,8 +1032,7 @@ static void ch_flower_stats_handler(struct work_struct 
*work)
do {
rhashtable_walk_start(&iter);
  
-		while ((flower_entry = rhashtable_walk_next(&iter)) &&

-  !IS_ERR(flower_entry)) {
+   while (!IS_ERR_OR_NULL((flower_entry = 
rhashtable_walk_next(&iter {
ret = cxgb4_get_filter_counters(adap->port[0],
flower_entry->filter_id,
&packets, &bytes,
diff --git a/drivers/net/ethernet/intel/ice/devlink/devlink.c 
b/drivers/net/ethernet/intel/ice/devlink/devlink.c
index 
6c72bd15db6d75a1d4fa04ef8fefbd26fb6e84bd..3d08b9187fd76ca3198af28111b6f1c1765ea01e
 100644
--- a/drivers/net/ethernet/intel/ice/devlink/devlink.c
+++ b/drivers/net/ethernet/intel/ice/devlink/devlink.c
@@ -791,7 +791,7 @@ static void ice_traverse_tx_tree(struct devlink *devlink, 
struct ice_sched_node
  node->parent->rate_node);
}
  
-	if (rate_node && !IS_ERR(rate_node))

+   if (!IS_ERR_OR_NULL(rate_node))
node->rate_node = rate_node;
  
  traverse_children:

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_router.c 
b/drivers/net/ethernet/marvell/prestera/prestera_router.c
index 
b036b173a308b5f994ad8538eb010fa27196988c..4492938e8a3da91d32efe8d45ccbe2eb437c0e49
 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_router.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_router.c
@@ -1061,7 +1061,7 @@ static void __prestera_k_arb_hw_state_upd(struct 
prestera_switch *sw,
n = NULL;
}
  
-	if (!IS_ERR(n) && n) {

+   if (!IS_ERR_OR_NULL(n)) {
neigh_event_send(n, NULL);
neigh_release(n);
} else {
diff --git a/drivers/net/ethernet/stmicro/stm

Re: [Intel-wired-lan] [PATCH 38/61] net: Prefer IS_ERR_OR_NULL over manual NULL check

2026-03-11 Thread Russell King (Oracle)
On Tue, Mar 10, 2026 at 12:49:04PM +0100, Philipp Hahn wrote:
> diff --git a/drivers/net/mdio/mdio-xgene.c b/drivers/net/mdio/mdio-xgene.c
> index 
> a8f91a4b7fed0927ee14e408000cd3a2bfb9b09a..09b30b563295c6085dc1358ac361301e5cf6b2a8
>  100644
> --- a/drivers/net/mdio/mdio-xgene.c
> +++ b/drivers/net/mdio/mdio-xgene.c
> @@ -265,7 +265,7 @@ struct phy_device *xgene_enet_phy_register(struct mii_bus 
> *bus, int phy_addr)
>   struct phy_device *phy_dev;
>  
>   phy_dev = get_phy_device(bus, phy_addr, false);
> - if (!phy_dev || IS_ERR(phy_dev))
> + if (IS_ERR_OR_NULL(phy_dev))

As noted in reply to your cover message, the check for NULL here is
incorrect - get_phy_device() returns either a valid pointer or an
error pointer, but never NULL.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


Re: [Intel-wired-lan] [PATCH 38/61] net: Prefer IS_ERR_OR_NULL over manual NULL check

2026-03-11 Thread Loktionov, Aleksandr


> -Original Message-
> From: Intel-wired-lan  On Behalf
> Of Philipp Hahn
> Sent: Tuesday, March 10, 2026 12:49 PM
> To: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected]; dm-
> [email protected]; [email protected];
> [email protected]; [email protected]; intel-wired-
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]; linux-security-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; [email protected];
> [email protected]; [email protected]; sched-
> [email protected]; [email protected]; tipc-
> [email protected]; [email protected]; Philipp Hahn
> 
> Cc: Igor Russkikh ; Andrew Lunn
> ; David S. Miller ; Eric
> Dumazet ; Jakub Kicinski ; Paolo
> Abeni ; Pavan Chebbi ;
> Michael Chan ; Potnuri Bharat Teja
> ; Nguyen, Anthony L ;
> Kitszel, Przemyslaw ; Taras Chornyi
> ; Maxime Coquelin
> ; Alexandre Torgue
> ; Iyappan Subramanian
> ; Keyur Chudgar
> ; Quan Nguyen
> ; Heiner Kallweit ;
> Russell King 
> Subject: [Intel-wired-lan] [PATCH 38/61] net: Prefer IS_ERR_OR_NULL
> over manual NULL check
> 
> Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL
> check.
> 
> Change generated with coccinelle.
> 
> To: Igor Russkikh 
> To: Andrew Lunn 
> To: "David S. Miller" 
> To: Eric Dumazet 
> To: Jakub Kicinski 
> To: Paolo Abeni 
> To: Pavan Chebbi 
> To: Michael Chan 
> To: Potnuri Bharat Teja 
> To: Tony Nguyen 
> To: Przemek Kitszel 
> To: Taras Chornyi 
> To: Maxime Coquelin 
> To: Alexandre Torgue 
> To: Iyappan Subramanian 
> To: Keyur Chudgar 
> To: Quan Nguyen 
> To: Heiner Kallweit 
> To: Russell King 
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Philipp Hahn 
> ---
>  drivers/net/ethernet/aquantia/atlantic/aq_ring.c| 2 +-
>  drivers/net/ethernet/broadcom/tg3.c | 2 +-
>  drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c| 3 +--
>  drivers/net/ethernet/intel/ice/devlink/devlink.c| 2 +-
>  drivers/net/ethernet/marvell/prestera/prestera_router.c | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c   | 2 +-
>  drivers/net/mdio/mdio-xgene.c   | 2 +-
>  drivers/net/usb/r8152.c | 2 +-
>  8 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> index
> e270327e47fd804cc8ee5cfd53ed1b993c955c41..43edef35c4b1ff606b2f1519a07f
> ad4c9a990ad4 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c
> @@ -810,7 +810,7 @@ static int __aq_ring_xdp_clean(struct aq_ring_s
> *rx_ring,
>   }
> 
>   skb = aq_xdp_run_prog(aq_nic, &xdp, rx_ring, buff);
> - if (IS_ERR(skb) || !skb)
> + if (IS_ERR_OR_NULL(skb))
>   continue;
> 
>   if (ptp_hwtstamp_len > 0)
> diff --git a/drivers/net/ethernet/broadcom/tg3.c
> b/drivers/net/ethernet/broadcom/tg3.c
> index
> 2328fce336447eb4a796f9300ccc0ab536ff0a35..8ed79f34f03d81184dcc12e6eaff
> 009cb8f7756e 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -7943,7 +7943,7 @@ static int tg3_tso_bug(struct tg3 *tp, struct
> tg3_napi *tnapi,
> 
>   segs = skb_gso_segment(skb, tp->dev->features &
>   ~(NETIF_F_TSO | NETIF_F_TSO6));
> - if (IS_ERR(segs) || !segs) {
> + if (IS_ERR_OR_NULL(segs)) {
>   tnapi->tx_dropped++;
>   goto tg3_tso_bug_end;
>   }
> diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_flower.c
> b/drivers/net/etherne