lkml.org 
[lkml]   [2011]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] staging: iio replaced kmalloc with local variables.
On 06/06/11 23:10, Joe Perches wrote:
> On Mon, 2011-06-06 at 14:55 -0700, Greg KH wrote:
>> On Tue, Jun 07, 2011 at 12:37:37AM +0530, anish wrote:
>>> From: anish kumar <anish198519851985@gmail.com>
>>> Replace kmalloc with local variables as it was un-necessary and
>>> also removed the redudant code after this change.
>> SPI data, like USB data, has to come from kmalloced data, not from the
>> stack, or bad things can, and will, happen.
>
> Perhaps just add a comment like:
>
> + u8 *tx = kmalloc(2, GFP_KERNEL); /* can't be on stack */
>
> It might be better to do a single kmalloc(4)
> than 2 separate kmalloc(2)'s.
Actually, this little corner of the driver is the only place it isn't
using the buffers allocated with the chip state. After I send our
latest clean up series in these are all explicitly marked
____cacheline_aligned anyway which should make it clear something
a little unusual is going on.

I'll clean up this function and credit it to Anish (if Anish doesn't
mind of course!)

Jonathan


\
 
 \ /
  Last update: 2011-06-07 11:31    [W:0.185 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site