+ error = input_register_device(hx->input_dev);
+ if (error) {
input_mt_destroy_slots() should be called here, or in an error handling path
below, or via a devm_add_action_or_reset().
This seems like a memory leak in every touchscreen driver; maybe it is more
practical to have the input core handle this clean-up.
Other drivers can and do insert other return paths between input_mt_init_slots()
and input_register_device(), so it seems that we cannot solve this by calling
input_mt_destroy_slots() from the error path within input_register_device().
Maybe a better option is to update input_mt_init_slots() to use device-managed
allocation instead?
It should also be called in a .remove function (unless
devm_add_action_or_reset is prefered)
I think the remove path is OK, as input_dev_release() handles this for us. In
case I have misunderstood, please let me know.