lkml.org 
[lkml]   [2014]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] drivers:input:ps2 Added sunxi A20 ps2 driver, changed makefile and Kconfig
From
Date
On December 5, 2014 7:50:18 AM PST, Arnd Bergmann <arnd@arndb.de> wrote:
>On Friday 05 December 2014 07:01:17 Dmitry Torokhov wrote:
>>
>> On December 5, 2014 2:33:11 AM PST, Arnd Bergmann <arnd@arndb.de>
>wrote:
>> >On Thursday 04 December 2014 04:23:44 vishnupatekar wrote:
>> >> +
>> >> +struct sunxips2data {
>> >> + int irq;
>> >> + spinlock_t ps2_lock;
>> >> + void __iomem *base_address; /* virt address of control
>registers*/
>> >> + struct serio *serio; /* serio*/
>> >> + struct device *dev;
>> >> + struct clk *pclk;
>> >> +};
>> >
>> >As this is dynamically allocated, better embed the serio member
>> >directly to avoid allocating both separately.
>>
>> That would be wrong - serio is refcounted and it may outlive instance
>of sunxips2data you embedded it into.
>
>Ok, I see. I guess in this case the use of devm_kzalloc for serio is a
>bug,
>because that would lead to a double free upon module unload, right?
>

Exactly. I already mentioned that in my review.

Thanks.

--
Dmitry


\
 
 \ /
  Last update: 2014-12-05 17:21    [W:0.037 / U:3.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site