mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Жамбакиев Радий Рикардинович" <r.zhambakiev@prosoftsystems.ru>
To: "andrew@lunn.ch" <andrew@lunn.ch>
Cc: "benato.denis96@gmail.com" <benato.denis96@gmail.com>,
	"petrm@nvidia.com" <petrm@nvidia.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
	"u.kleine-koenig@baylibre.com" <u.kleine-koenig@baylibre.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>,
	"jacob.e.keller@intel.com" <jacob.e.keller@intel.com>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net 1/3] net: fealnx: fix teardown order in remove
Date: Mon, 28 Sep 2026 12:31:16 +0000	[thread overview]
Message-ID: <d20c94930acc066f48abb40f82bdfadaa5ca30c2.camel@prosoftsystems.ru> (raw)
In-Reply-To: <95c9fa4a-79e5-47fe-9de5-2c6cd186216d@lunn.ch>

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.

  reply	other threads:[~2026-09-28 12:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24 10:44 Жамбакиев Радий Рикардинович
2026-09-24 10:44 ` [PATCH net 2/3] net: fealnx: disable the PCI device on remove and probe failure Жамбакиев Радий Рикардинович
2026-09-24 21:52   ` Francois Romieu
2026-09-24 10:44 ` [PATCH net 3/3] net: fealnx: allocate the card index from an IDA Жамбакиев Радий Рикардинович
2026-09-24 16:50   ` Andrew Lunn
2026-09-24 16:43 ` [PATCH net 1/3] net: fealnx: fix teardown order in remove Andrew Lunn
2026-09-28 12:31   ` Жамбакиев Радий Рикардинович [this message]
2026-09-24 21:51 ` Francois Romieu
2026-09-28 12:32   ` Жамбакиев Радий Рикардинович
2026-09-25 10:46 ` netdev-bot+sashiko
2026-09-28 13:08   ` Жамбакиев Радий Рикардинович

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d20c94930acc066f48abb40f82bdfadaa5ca30c2.camel@prosoftsystems.ru \
    --to=r.zhambakiev@prosoftsystems.ru \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=benato.denis96@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lvc-project@linuxtesting.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=stable@vger.kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®