linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Michal Nazarewicz <mina86@mina86.com>
Cc: linux-usb@vger.kernel.org, <Linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [PATCH] usb: core: config.c: usb_get_configuration() simplified
Date: Sat, 17 Apr 2010 12:13:34 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1004171212550.6609-100000@netrider.rowland.org> (raw)
In-Reply-To: <87sk6uaz9h.fsf@erwin.mina86.com>

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@mina86.com>
> ---
>  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@rowland.harvard.edu> 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


  reply	other threads:[~2010-04-17 16:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-17 12:38 [PATCH] usb: core: config.c: use buffer on stack rather then on heap Michal Nazarewicz
2010-04-17 14:42 ` Alan Stern
2010-04-17 15:12   ` [PATCH] usb: core: config.c: usb_get_configuration() simplified Michal Nazarewicz
2010-04-17 16:13     ` Alan Stern [this message]
2010-04-29 23:21     ` patch usb-core-config.c-usb_get_configuration-simplified.patch added to gregkh-2.6 tree gregkh

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=Pine.LNX.4.44L0.1004171212550.6609-100000@netrider.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=gregkh@suse.de \
    --cc=linux-usb@vger.kernel.org \
    --cc=mina86@mina86.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).