Re: [PATCH] ch341: Replace memory allocations with stack storage

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

 



On Fri, Feb 21, 2020 at 07:23:41PM +0000, Michael Hanselmann wrote:
> Storing a memory pointer consumes 4 or 8 bytes, depending on the
> architecture. The replaced buffers are 2 bytes, so this change not only
> avoids the overhead of memory allocation, but it also saves a small
> amount of stack storage.
> 
> Signed-off-by: Michael Hanselmann <public@xxxxxxxxx>
> ---
>  drivers/usb/serial/ch341.c | 32 ++++++++------------------------
>  1 file changed, 8 insertions(+), 24 deletions(-)

You should have gotten a runtime error with this change if you tested
it.  Did that not happen somehow?

As Johan said, all USB data has to be dynamically allocated.

thanks,

greg k-h



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

  Powered by Linux