Skip to contentSkip to conversation

net: rnpgbe: Delete a null pointer check in rnpgbe_rm_adapter()

PATCH In review Markus Elfring 3 participants 3 messages Jul 17 – Jul 22

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 net: rnpgbe: Delete a null pointer check in rnpgbe_rm_adapter()

From: Markus Elfring <[email protected]>
Date: Fri, 17 Jul 2026 10:20:15 +0200

The check for the pointer “mucse” was identified as redundant because the relevant address information was preserved according to calls of the functions “pci_set_drvdata” and “pci_get_drvdata”. Thus remove it.

This issue was detected by using the Coccinelle software.

See also:
Reconsidering pointer dereferences before null pointer checks (with SmPL) 2023-04-09
https://lore.kernel.org/cocci/[email protected]/
https://sympa.inria.fr/sympa/arc/cocci/2023-04/msg00021.html

---

v3:
Andrew Lunn and Julia Lawall requested an extended change description.

v2:
Andrew Lunn requested the removal of a null pointer check.

 drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c | 2 --
 1 file changed, 2 deletions(-)
drivers/net/ethernet/mucse/rnpgbe/rnpgbe_main.c +0 -2
index 70a2b0082ba8..82a3fbfb3c0a 100644
@@ -249,8 +249,6 @@ static void rnpgbe_rm_adapter(struct pci_dev *pdev)
 	struct net_device *netdev;
 	int err;
 
-	if (!mucse)
-		return;
 	netdev = mucse->netdev;
 	unregister_netdev(netdev);
 	err = rnpgbe_send_notify(hw, false, mucse_fw_powerup);
Signature · 1 line
2.55.0
Reviewed-by on v3 1/1
#1 lore raw
Quoted 10 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Fri, 17 Jul 2026 10:20:15 +0200

The check for the pointer “mucse” was identified as redundant because the relevant address information was preserved according to calls of the functions “pci_set_drvdata” and “pci_get_drvdata”. Thus remove it.

This issue was detected by using the Coccinelle software.

Quoted 7 lines

See also:
Reconsidering pointer dereferences before null pointer checks (with SmPL) 2023-04-09
https://lore.kernel.org/cocci/[email protected]/
https://sympa.inria.fr/sympa/arc/cocci/2023-04/msg00021.html

Andrew

maintainer
#2 lore raw
In reply to Markus Elfring
Quoted 9 lines · On Fri, 17 Jul 2026 10:38:32 +0200 Markus Elfring wrote:

From: Markus Elfring <[email protected]>
Date: Fri, 17 Jul 2026 10:20:15 +0200

The check for the pointer “mucse” was identified as redundant because the relevant address information was preserved according to calls of the functions “pci_set_drvdata” and “pci_get_drvdata”. Thus remove it.

This issue was detected by using the Coccinelle software.

pointless churn, please don't waste our time