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

Reply via email to