From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39DE7C47089 for ; Tue, 6 Dec 2022 01:17:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233169AbiLFBRf (ORCPT ); Mon, 5 Dec 2022 20:17:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232064AbiLFBRe (ORCPT ); Mon, 5 Dec 2022 20:17:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AC3A1B9; Mon, 5 Dec 2022 17:17:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D9D81B815E0; Tue, 6 Dec 2022 01:17:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 220FDC433C1; Tue, 6 Dec 2022 01:17:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670289449; bh=0VbtXfKMz3whFPEb/H/s13bi+Cef1Em/J2GZ2Ss9VKU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Vrs6iHXU7DskarPWQ7gdqUT6FozBt2wt0+0QDSAD5nSZICiK68lV0O8FJeOQDNclc 2jJMLvdwrkOsIh3LECSO3Job1M6CwTiPP/z16Zd10xbrXiwVlZ7HXnNtP32Rrpk7MC S1mDIfcYjV7TyA5QdwhirjYgPmR86yKC13iWbplCOx3jGofL8p57g+I9kicV4AEwmF tp3gmTV0OQbAU/mBVG2pXmCQGQix4/d2ZGU7ZGxbvLLo+VC31XggYDheI79Pq7anou J0ed7sjgMYnEOvRSksFajUGgMeCR1k520T/HAfk60aZgg3rdeTfCCrXdb3kSA6/zT+ BOi4gEkewSyPA== Date: Mon, 5 Dec 2022 17:17:27 -0800 From: Jakub Kicinski To: Leon Romanovsky , Lucas Stach Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, "David S . Miller" , Eric Dumazet , Paolo Abeni , kernel@pengutronix.de, patchwork-lst@pengutronix.de Subject: Re: [PATCH 2/2] net: asix: Avoid looping when the device is diconnected Message-ID: <20221205171727.56210845@kernel.org> In-Reply-To: References: <20221201175525.2733125-1-l.stach@pengutronix.de> <20221201175525.2733125-2-l.stach@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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 > > --- > > 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).