Thread (12 messages) 12 messages, 4 authors, 5d ago

Re: [PATCH net 1/3] net: fealnx: fix teardown order in remove

From: Жамбакиев Радий Рикардинович <hidden>
Date: 2026-09-28 12:31:25
Also in: lkml, stable

On Thu, 2026-09-24 at 18:43 +0200, Andrew Lunn wrote:
quoted
---
 drivers/net/ethernet/fealnx.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/fealnx.c
b/drivers/net/ethernet/fealnx.c
index bdc38aac5850..d7cd1644a375 100644
--- a/drivers/net/ethernet/fealnx.c
+++ b/drivers/net/ethernet/fealnx.c
@@ -678,20 +678,23 @@ static int fealnx_init_one(struct pci_dev
*pdev,
 static void fealnx_remove_one(struct pci_dev *pdev)
 {
      struct net_device *dev = pci_get_drvdata(pdev);
+     struct netdev_private *np;
+
+     if (!dev) {
+             dev_err(&pdev->dev, "remove for unknown device\n");
+             return;
+     }
I know you are just moving code around, but is that possible?  We try
avoid defensive code. It is better to actually understand the code
and stop bad things happening.

     Andrew
Thank you for review.

This is actually not possible as successful probe always sets the dev
and it will never be NULL. If probe returned early with an error,
remove wont be called at all.

I will remove it if refactoring will be approved in result of this
thread, as it is more code quality fix, then an error.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help