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

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

From: Jiri Kosina <hidden>
Date: 2007-10-29 17:29:04
Also in: lkml

On Mon, 29 Oct 2007, Dirk Hohndel wrote:
	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.
Actually both of the cases are fine -- it is valid to pass NULL pointer to 
kfree() and to input_free_device() too.
Would something like this work?
Yes, I think that this patch is in principle fine, modulo the redundant 
NULL-ptr checks.

Thanks,

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