Commit d1d2f83f authored by Wei Yongjun's avatar Wei Yongjun Committed by Greg Kroah-Hartman

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: default avatarWei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 641f064e
......@@ -547,10 +547,8 @@ static int cp_tm1217_probe(struct i2c_client *client,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment