[lvc-project] [PATCH net 1/3] net: fealnx: fix teardown order in remove
Жамбакиев Радий Рикардинович
r.zhambakiev at prosoftsystems.ru
Mon Sep 28 15:31:16 MSK 2026
On Thu, 2026-09-24 at 18:43 +0200, Andrew Lunn wrote:
> > ---
> > 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.
More information about the lvc-project
mailing list