All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Michael Hanselmann <public@hansmi.ch>
Cc: Johan Hovold <johan@kernel.org>, linux-usb@vger.kernel.org
Subject: Re: [PATCH] ch341: Replace memory allocations with stack storage
Date: Sun, 23 Feb 2020 11:02:11 +0100	[thread overview]
Message-ID: <20200223100211.GC120495@kroah.com> (raw)
In-Reply-To: <bdf7db0e0e133f55ac81d39ce9564653e0b5d9ed.1582312740.git.public@hansmi.ch>

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@hansmi.ch>
> ---
>  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

  parent reply	other threads:[~2020-02-23 10:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-21 19:23 [PATCH] ch341: Replace memory allocations with stack storage Michael Hanselmann
2020-02-22  9:50 ` Johan Hovold
2020-02-23 10:02 ` Greg KH [this message]
2020-02-23 10:06   ` Michael Hanselmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200223100211.GC120495@kroah.com \
    --to=greg@kroah.com \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=public@hansmi.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.