[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ajje6wfqyyqocpx2nm6nmw3quubmg5l3zhuxv7ds2444hykgy5@xbi7uttxghv2>
Date: Thu, 21 Aug 2025 11:00:46 +0800
From: Xu Yang <xu.yang_2@....com>
To: Oliver Neukum <oneukum@...e.com>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
kuba@...nel.org, pabeni@...hat.com, linux-usb@...r.kernel.org,
netdev@...r.kernel.org
Subject: Re: [PATCH] net: usbnet: skip info->stop() callback if suspend_count
is not 0
On Mon, Aug 18, 2025 at 11:04:55AM +0200, Oliver Neukum wrote:
> On 8/18/25 09:57, Xu Yang wrote:
>
> > --- a/drivers/net/usb/usbnet.c
> > +++ b/drivers/net/usb/usbnet.c
> > @@ -839,7 +839,7 @@ int usbnet_stop (struct net_device *net)
> > pm = usb_autopm_get_interface(dev->intf);
>
> This needs to fail ...
It returns 0, so "pm = 0" here which means it succeed.
>
> > /* allow minidriver to stop correctly (wireless devices to turn off
> > * radio etc) */
> > - if (info->stop) {
> > + if (info->stop && !dev->suspend_count) {
>
> ... for !dev->suspend_count to be false
The suspend_count won't go to 0 because there is no chance to call
usbnet_resume() if the USB device is physically disconnected from the
USB port during system suspend.
>
> > retval = info->stop(dev);
> > if (retval < 0)
> > netif_info(dev, ifdown, dev->net,
>
> In other words, this means that the driver has insufficient
> error handling in this method. This needs to be fixed and it
> needs to be fixed explicitly. We do not hide error handling.
Do you mean info->stop() should be called and return error code if something
is wrong?
>
> Please use a literal "if (pm < 0)" to skip the parts we need to skip
> if the resumption fails.
pm = 0 here.
Thanks,
Xu Yang
>
> Regards
> Oliver
>
> NACKED-BY: Oliver Neukum <oneukum@...e.com>
Powered by blists - more mailing lists