netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Leon Romanovsky <leon@kernel.org>, Lucas Stach <l.stach@pengutronix.de>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	kernel@pengutronix.de, patchwork-lst@pengutronix.de
Subject: Re: [PATCH 2/2] net: asix: Avoid looping when the device is diconnected
Date: Mon, 5 Dec 2022 17:17:27 -0800	[thread overview]
Message-ID: <20221205171727.56210845@kernel.org> (raw)
In-Reply-To: <Y4yI95L+LYhp5ESL@unreal>

On Sun, 4 Dec 2022 13:48:07 +0200 Leon Romanovsky wrote:
> On Thu, Dec 01, 2022 at 06:55:25PM +0100, Lucas Stach wrote:
> > We've seen device access fail with -EPROTO when the device has been
> > recently disconnected and before the USB core had a chance to handle
> > the disconnect hub event. It doesn't make sense to continue on trying
> > to enable host access when the adapter is gone.
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  drivers/net/usb/asix_common.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
> > index be1e103b7a95..28b31e4da020 100644
> > --- a/drivers/net/usb/asix_common.c
> > +++ b/drivers/net/usb/asix_common.c
> > @@ -96,7 +96,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm)
> >  
> >  	for (i = 0; i < AX_HOST_EN_RETRIES; ++i) {
> >  		ret = asix_set_sw_mii(dev, in_pm);
> > -		if (ret == -ENODEV || ret == -ETIMEDOUT)
> > +		if (ret == -ENODEV || ret == -ETIMEDOUT || ret == -EPROTO)  
> 
> It looks like you can put if (ret < 0) here,

Right, or we need a clarification in the commit message why it's okay
to continue for other errors (and continue as if the error didn't
happen, not just retry).

  reply	other threads:[~2022-12-06  1:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-01 17:55 [PATCH 1/2] net: asix: Simplify return value check after asix_check_host_enable Lucas Stach
2022-12-01 17:55 ` [PATCH 2/2] net: asix: Avoid looping when the device is diconnected Lucas Stach
2022-12-04 11:48   ` Leon Romanovsky
2022-12-06  1:17     ` Jakub Kicinski [this message]
2022-12-04 11:46 ` [PATCH 1/2] net: asix: Simplify return value check after asix_check_host_enable Leon Romanovsky

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=20221205171727.56210845@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=leon@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=patchwork-lst@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).