Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -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;