Re: [PATCH] usb: core: config.c: usb_get_configuration() simplified

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

 



On Sat, 17 Apr 2010, Michal Nazarewicz wrote:

> usb_gat_configuratio() used two pointers to point to the same
> memory.  Code simplified, by removing one of them.
> 
> Signed-off-by: Michal Nazarewicz <mina86@xxxxxxxxxx>
> ---
>  drivers/usb/core/config.c |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
> 
> > On Sat, 17 Apr 2010, Michal Nazarewicz wrote:
> >> usb_get_configuration() uses a temporary buffer allocated on heap
> >> to read USB configuration descriptor.  The buffer is just nine
> >> bytes an so it is a waste to allocate it on heap where it can be
> >> allocated on stack with the rest of local variables.  This
> >> simplifies the code and minimises memory usage.
> 
> Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> writes:
> > This is completely wrong.  You are not allowed to do DMA to buffers on 
> > the stack; some architectures are not capable of handling it.
> 
> That makes sense; I haven't considered this thinking that copying nine
> bytes by CPU, rather then using DMA, is not a big issue.
> 
> Still, the change proposed by attached commit does not suffer from DMA
> issue and still simplify the code.

Yes, this is fine.

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