Thread (14 messages) 14 messages, 4 authors, 2007-10-29

Re: [PATCH] INPUT: fix hidinput_connect ignoring retval from input_register_device

flat view

From: Hohndel, Dirk <hidden>
Date: 2007-10-29 15:38:55
Also in: lkml

On Oct 29, 2007, at 8:33 AM, Dmitry Torokhov wrote:
On 10/29/07, Dirk Hohndel [off-list ref] wrote:
quoted
Actually, the more I look at the code that bails when it runs out of memory,
the more I wonder about that.

       hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL);
       input_dev = input_allocate_device();
       if (!hidinput || !input_dev) {
               kfree(hidinput);
               input_free_device(input_dev);

This either passes a NULL pointer to kfree or to input_free_device. That's
not nice.
No, that's allright. input_free_device() takes after kfree() so that
it safe to call it with NULL pointer.
Ahh - should have checked that.

Will the rest of the patch work with the call to hidinput_disconnect? If yes then
I'll send a cleaned up version that removes the unnecessary checks in the case here...

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