lkml.org 
[lkml]   [2013]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v1.1] gpiolib: append SFI helpers for GPIO API
From
On Mon, Jun 3, 2013 at 3:26 PM, Joe Perches <joe@perches.com> wrote:
> On Mon, 2013-06-03 at 11:16 +0300, Andy Shevchenko wrote:
>> On Sun, 2013-06-02 at 19:06 -0700, Joe Perches wrote:
>> > On Mon, 2013-06-03 at 11:59 +1000, Ryan Mallon wrote:
>> > > On 31/05/13 19:27, Andy Shevchenko wrote:
>> > > > + sfi_gpio_table = kmalloc(num * sizeof(*pentry), GFP_KERNEL);
>> > > Use kcalloc when you have a size and a count.
>> > kmalloc_array unless you want zero'ed memory
>> One proposed to use kmemdup to clean up a bit. What do you think?
>
> Seems correct to use kmemdup but what validates num?

num comes from SFI firmware. We only could rely on what kmalloc/kmemdup returns.

> It seems like a possible error path exists there regardless
> of whether kmemdup is used or not.

That's true. The advantage of kmemdup is an implicit memcpy. Thus, we
could drop away that line.

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2013-06-05 16:21    [W:0.547 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site