Re: [PATCH experimental 2/6] usb: cdc-wdm: prepare endpoint detection for interfaces with > 1 endpoint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 24 Jan 2012, Bjørn Mork wrote:

> @@ -636,7 +638,13 @@ static struct wdm_device *wdm_create(struct usb_interface *intf, struct usb_endp
>  	INIT_WORK(&desc->rxwork, wdm_rxwork);
>  
>  	rv = -EINVAL;
> -	if (!ep || !usb_endpoint_is_int_in(ep))
> +	iface = intf->cur_altsetting;
> +	for (i = 0; i < iface->desc.bNumEndpoints; i++) {
> +		ep = &iface->endpoint[i].desc;
> +		if (ep && usb_endpoint_is_int_in(ep))

Testing ep at this point makes no sense.  Do you understand why?  Hint: 
Consider what value ep would have if desc were not the first field in 
the usb_host_endpoint structure.

It would make more sense to test iface->endpoint[i] -- but that can't
be NULL either; this is guaranteed by usbcore.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux