From: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, Alan Stern <stern@rowland.harvard.edu>
Subject: Re: [PATCH v2] media: stk1160: Avoid stack-allocated buffer for control URBs
Date: Fri, 9 May 2014 10:07:15 -0300 [thread overview]
Message-ID: <20140509130715.GA764@arch.cereza> (raw)
In-Reply-To: <536CAF29.4030200@xs4all.nl>
On 09 May 12:34 PM, Hans Verkuil wrote:
> Hi Ezequiel,
>
> On 04/17/2014 02:28 PM, Ezequiel Garcia wrote:
> > Currently stk1160_read_reg() uses a stack-allocated char to get the
> > read control value. This is wrong because usb_control_msg() requires
> > a kmalloc-ed buffer.
> >
> > This commit fixes such issue by kmalloc'ating a 1-byte buffer to receive
> > the read value.
> >
> > While here, let's remove the urb_buf array which was meant for a similar
> > purpose, but never really used.
>
> Rather than allocating and freeing a buffer for every read_reg I would allocate
> this buffer in the probe function.
>
> That way this allocation is done only once.
>
I get your point. I just thought that since the control URBs are only used for
changing the configuration parameters, and this path is scarcely taken, it wasn't
a big deal to allocate it each time.
--
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-05-09 13:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-17 12:28 [PATCH v2] media: stk1160: Avoid stack-allocated buffer for control URBs Ezequiel Garcia
2014-04-25 21:51 ` Ezequiel Garcia
2014-04-28 16:42 ` Sander Eikelenboom
2014-05-09 10:34 ` Hans Verkuil
2014-05-09 13:07 ` Ezequiel Garcia [this message]
2014-05-17 12:21 ` Ezequiel Garcia
2014-05-23 10:38 ` Hans Verkuil
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=20140509130715.GA764@arch.cereza \
--to=ezequiel.garcia@free-electrons.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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