staging: cptm1217: don't call input_free_device() after input_unregister_device()

input_free_device() should only be used if input_register_device()
was not called yet or if it failed. Once device was unregistered
use input_unregister_device() and memory will be freed once last
reference to the device is dropped.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Wei Yongjun 2013-04-24 10:40:00 +08:00 committed by Greg Kroah-Hartman
parent 641f064e5d
commit d1d2f83f85
1 changed files with 1 additions and 3 deletions

View File

@ -547,10 +547,8 @@ fail_gpio:
fail:
/* Clean up before returning failure */
for (i = 0; i < TOUCH_SUPPORTED; i++) {
if (ts->cp_input_info[i].input) {
if (ts->cp_input_info[i].input)
input_unregister_device(ts->cp_input_info[i].input);
input_free_device(ts->cp_input_info[i].input);
}
}
kfree(ts);
return retval;