Skip to contentSkip to conversation

OMAP: Add keypad driver

PATCH In review Komal Shah 2 participants 2 messages Jul 26, 2006

lore
Share & tools
lore
#1 lore raw
Quoted 9 lines · Komal Shah

Andrew/Tony/Richard/Dmitry,

This is a revised patch as per the review comments from the Dmitry on thread:

http://lkml.org/lkml/2006/7/25/279

Please review it and give me the Ack if looks ok.

Komal,

You may not call input_free_device() after calling input_unregister_device() in the error path because unregister will drop the reference to the device and since it was the last (and only) reference it will free the device. input_free_device() coming after that will try to free already freed memory.

You have several options:
1. Have separate error paths for before and after input_register_device()
2. Set input_dev = NULL after calling input_unregister_device() - input-free-device() handles NULLs just fine.
3. Take an extra reference with input_get_device() before calling input_unregister_device(). This way the device won't actually be freed until you call input_free_device() later.

Signature · 1 line
Dmitry