Re: [PATCH net] net: qmi_wwan: fix Oops while disconnecting
From: Oliver Neukum <hidden>
Date: 2012-06-23 20:55:08
Am Samstag, 23. Juni 2012, 17:32:09 schrieb Bjørn Mork:
Ming Lei [off-list ref] writes:quoted
On Sat, Jun 23, 2012 at 4:45 PM, Bjørn Mork [off-list ref] wrote:
quoted
Suppose there will be another usbnet driver which has its own subdriver too, the same trick of checking need to be added again if not taking the general way of simply removing 'usb_set_intfdata(intf, NULL);' in usbnet_disconnect.Yes, I guess so. I am just worrying (maybe too much) about the unknown consequences of removing that code in usbnet, not fully understanding why it was there in the first place. And I do not want to take the blame and cleanup work if anything goes wrong :-) Fixing it in qmi_wwan feels much safer.
void usbnet_cdc_unbind(struct usbnet *dev, struct usb_interface *intf)
{
struct cdc_state *info = (void *) &dev->data;
struct usb_driver *driver = driver_of(intf);
/* disconnect master --> disconnect slave */
if (intf == info->control && info->data) {
/* ensure immediate exit from usbnet_disconnect */
usb_set_intfdata(info->data, NULL);
usb_driver_release_interface(driver, info->data);
info->data = NULL;
1. We mirror the minidrivers closely, which reduces errors
2. unbind() is called with the data anyway and after disconnect()
the intfdata is not valid anyway, because the interface may have been
reprobed.
Regarsd
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html