strange code in cdc-ncm
Subsystems (2)
Hi,
I was looking at this code:
static void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf)
{
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
struct usb_driver *driver;
if (ctx == NULL)
return; /* no setup */
driver = driver_of(intf);
usb_set_intfdata(ctx->data, NULL);
usb_set_intfdata(ctx->control, NULL);
usb_set_intfdata(ctx->intf, NULL);
/* release interfaces, if any */
if (ctx->data_claimed) {
usb_driver_release_interface(driver, ctx->data);
ctx->data_claimed = 0;
}
if (ctx->control_claimed) {
usb_driver_release_interface(driver, ctx->control);
ctx->control_claimed = 0;
}It seems a bit strange to me. If you may or may not have claimed an interface, how can you unconditionally zero out intfdata?
Regards
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html