* strange code in cdc-ncm
@ 2011-05-14 20:58 Oliver Neukum
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2011-05-14 20:58 UTC (permalink / raw)
To: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
Alexey Orishko
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: strange code in cdc-ncm
@ 2011-05-15 11:21 Alexey ORISHKO
0 siblings, 0 replies; 2+ messages in thread
From: Alexey ORISHKO @ 2011-05-15 11:21 UTC (permalink / raw)
To: Oliver Neukum
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>
> 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
Hi Oliver, thanks for pointing out. I'll make a fix and post a patch.
Best regards,
Alexey
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-05-15 11:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-14 20:58 strange code in cdc-ncm Oliver Neukum
-- strict thread matches above, loose matches on Subject: below --
2011-05-15 11:21 Alexey ORISHKO
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).