Thread (4 messages) flat view 4 messages, 2 authors, 2012-03-07

Re: [PATCH] input: altera_ps2: Store struct serio in struct ps2if

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-03-07 17:25:33

Hi Tobias,

On Wed, Mar 07, 2012 at 02:44:24PM +0100, Tobias Klauser wrote:
It doesn't make much sense to allocate struct ps2if and struct serio
separately as they're allocated and used in conjunction.
Actually, it does. Serio is a refcounted structure and has different
lifetime rules than struct ps2if. It may get deleted by
serio_unregister_port() or it may live on until after ps2if is freed and
altera_ps2 module is unloaded and it should stay allocated separately.
Also ps2if->io wasn't freed in altera_ps2_remove() even tough it should
have been and thus caused a memory leak. This is also (implicitely)
fixed by this change.
No, there was't a memory leak as serio core takes care of freeing the
object when refrerence count reaches 0.

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help