lkml.org 
[lkml]   [2011]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v4] usb: gadget: storage_common: make FSG_NUM_BUFFERS variable size
Date
From
On Fri, 19 Aug 2011 13:42:08 +0200, Per Forlin <per.forlin@linaro.org>  
wrote:
> Is it true that fsg_common_init() will never be called twice to
> initialise the same fsg_common structure. It is always called once
> followed by release.
> If this is the case it is safe to only:
> if (common->buffhds)
> common->buffhds = kzalloc()
You should just always do common->buffhds = kcalloc(fsg_num_buffhds,
sizeof *common->buffhds, GFP_KERNEL) in fsg_common_init() and then
kfree() in release.

--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, Michal "mina86" Nazarewicz (o o)
ooo +-----<email/xmpp: mnazarewicz@google.com>-----ooO--(_)--Ooo--

\
 
 \ /
  Last update: 2011-08-19 14:55    [from the cache]
©2003-2011 Jasper Spaans