Re: [PATCH/RESEND v6 2/6] usb: Add usb_endpoint_descriptor to be part of the struct usb_ep

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

 



Tatyana Brokhman wrote:
> Change usb_ep_enable() prototype to use endpoint descriptor from usb_ep.
> This optimization spares the FDs from saving the endpoint chosen
> descriptor. This optimization is not full though. To fully exploit this
> change one needs to update all the UDCs as well since in the current
> implementation each of them saves the endpoint descriptor in it's
> internal (and extended) endpoint structure.

Hi Tatyana,

> diff --git a/drivers/usb/gadget/f_audio.c b/drivers/usb/gadget/f_audio.c
> index 9abecfd..0ed0f97 100644
> --- a/drivers/usb/gadget/f_audio.c
> +++ b/drivers/usb/gadget/f_audio.c
> @@ -279,7 +279,6 @@ struct f_audio {
>  
>  	/* endpoints handle full and/or high speeds */
>  	struct usb_ep			*out_ep;
> -	struct usb_endpoint_descriptor	*out_desc;
>  
>  	spinlock_t			lock;
>  	struct f_audio_buf *copy_buf;
> @@ -575,7 +574,7 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
>  
>  	if (intf == 1) {
>  		if (alt == 1) {
> -			usb_ep_enable(out_ep, audio->out_desc);
> +			usb_ep_enable(out_ep);
>  			out_ep->driver_data = audio;
>  			audio->copy_buf = f_audio_buffer_alloc(audio_buf_size);
>  			if (IS_ERR(audio->copy_buf))
> @@ -775,7 +774,7 @@ int __init audio_bind_config(struct usb_configuration *c)
>  	audio->card.func.set_alt = f_audio_set_alt;
>  	audio->card.func.setup = f_audio_setup;
>  	audio->card.func.disable = f_audio_disable;
> -	audio->out_desc = &as_out_ep_desc;
> +	audio->out_ep->desc = &as_out_ep_desc;

I guess you didn't test the audio gadget with this patch? This last change
causes a NULL pointer dereference, because 'audio' was allocated in this
function, and nothing has set the 'out_ep' pointer yet.

Also, why do you submit the patch series with different version numbers
on each patch? I find that confusing. The normal way it's done is to
bump the version number on every patch in the series, even if some of
them have not changed.

-- 
Paul

--
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