Hi Stafan,

On 19 December 2015 at 08:23, Stefan Bruens
<[email protected]> wrote:
> On Friday 18 December 2015 15:41:10 Simon Glass wrote:
>> Hi,
>>
>> On 17 December 2015 at 18:07, Stefan Brüns <[email protected]>
> wrote:
>> > The configuration descriptor includes all interface, endpoint and
>> > auxiliary descriptors (e.g. report, union) so 512 bytes may not be enough.
>> >
>> > Signed-off-by: Stefan Brüns <[email protected]>
>> > ---
>> >
>> >  common/usb.c  | 41 +++++++++++++++++++++++++++--------------
>> >  include/usb.h |  5 +++--
>> >  2 files changed, 30 insertions(+), 16 deletions(-)
>>
>> Won't this call malloc() on every request? Can we avoid that?
>
> This only affects the configuration descriptor, so one allocation per device.
>
> One could use a stack allocated buffer for small, e.g. 512 bytes, descriptors,
> and use dynamic allocation only for larger one, but I don't think this is
> worth the effort.
>
> Kind regards,
>
> Stefan


Another approach would be to have a single buffer for the USB stack
and increase its size as needed. But if this is only once per device
it does not seem worth it either.

Don't you need to free the buffer if usb_get_configuration_no()
returns an error?

Otherwise:

Reviewed-by: Simon Glass <[email protected]>

Regards,
Simon
_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to