> > > From: Philipp Hahn <[email protected]> > Sent: Tuesday, March 10, 2026 1:49 PM > To: [email protected]; [email protected]; > [email protected]; [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; > [email protected]; [email protected]; Philipp Hahn > <[email protected]> > Cc: Igor Russkikh <[email protected]>; Andrew Lunn > <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet > <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni > <[email protected]>; Pavan Chebbi <[email protected]>; Michael Chan > <[email protected]>; Potnuri Bharat Teja <[email protected]>; Tony Nguyen > <[email protected]>; Przemek Kitszel <[email protected]>; > Taras Chornyi <[email protected]>; Maxime Coquelin > <[email protected]>; Alexandre Torgue <[email protected]>; > Iyappan Subramanian <[email protected]>; Keyur Chudgar > <[email protected]>; Quan Nguyen <[email protected]>; > Heiner Kallweit <[email protected]>; Russell King <[email protected]> > Subject: [EXTERNAL] [PATCH 38/61] net: Prefer IS_ERR_OR_NULL over manual NULL > check > ZjQcmQRYFpfptBannerEnd > Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL > check. > > Change generated with coccinelle. > > To: Igor Russkikh <mailto:[email protected]> > To: Andrew Lunn <mailto:[email protected]> > To: "David S. Miller" <mailto:[email protected]> > To: Eric Dumazet <mailto:[email protected]> > To: Jakub Kicinski <mailto:[email protected]> > To: Paolo Abeni <mailto:[email protected]> > To: Pavan Chebbi <mailto:[email protected]> > To: Michael Chan <mailto:[email protected]> > To: Potnuri Bharat Teja <mailto:[email protected]> > To: Tony Nguyen <mailto:[email protected]> > To: Przemek Kitszel <mailto:[email protected]> > To: Taras Chornyi <mailto:[email protected]> > To: Maxime Coquelin <mailto:[email protected]> > To: Alexandre Torgue <mailto:[email protected]> > To: Iyappan Subramanian <mailto:[email protected]> > To: Keyur Chudgar <mailto:[email protected]> > To: Quan Nguyen <mailto:[email protected]> > To: Heiner Kallweit <mailto:[email protected]> > To: Russell King <mailto:[email protected]> > Cc: mailto:[email protected] > Cc: mailto:[email protected] > Cc: mailto:[email protected] > Cc: mailto:[email protected] > Cc: mailto:[email protected] > Cc: mailto:[email protected] > Signed-off-by: Philipp Hahn <mailto:[email protected]> > --- > 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/stmmac/stmmac_main.c > b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index > 6827c99bde8c22db42b363d2d36ad6f26075ed50..356a4e9ce04b1fcf8786d7274d31ace404be2cf6 > 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -1275,7 +1275,7 @@ static int stmmac_init_phy(struct net_device *dev) > /* Some DT bindings do not set-up the PHY handle. Let's try to > * manually parse it > */ > - if (!phy_fwnode || IS_ERR(phy_fwnode)) { > + if (IS_ERR_OR_NULL(phy_fwnode)) { > int addr = priv->plat->phy_addr; > struct phy_device *phydev; > > 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)) > return NULL; > > if (phy_device_register(phy_dev)) > diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > index > 0c83bbbea2e7c322ee6339893e281237663bd3ae..73f17ebd7d40007eec5004f887a46249defd28ab > 100644 > --- a/drivers/net/usb/r8152.c > +++ b/drivers/net/usb/r8152.c > @@ -2218,7 +2218,7 @@ static void r8152_csum_workaround(struct r8152 *tp, > struct sk_buff *skb, > > features &= ~(NETIF_F_SG | NETIF_F_IPV6_CSUM | NETIF_F_TSO6); > segs = skb_gso_segment(skb, features); > - if (IS_ERR(segs) || !segs) > + if (IS_ERR_OR_NULL(segs)) > goto drop; > > __skb_queue_head_init(&seg_list); > > -- > 2.43.0 > >
Acked-by: Elad Nachman <[email protected]>
