Fix kernel trace when execting mutex lock

Init mutex lock before use or will cause call trace:
05-17 16:54:07.141 1504 1504 I Call trace:
05-17 16:54:07.141 1504 1504 I : __mutex_lock+0xc7c/0xdcc
05-17 16:54:07.141 1504 1504 I : mutex_lock_nested+0x4c/0x5c
05-17 16:54:07.141 1504 1504 I : cyttsp5_sensor_set_enable+0x4c/0xac [parade_tma5xx_mmi_core]
05-17 16:54:07.141 1504 1504 I : sensors_enable_store+0x88/0x104 [sensors_class]
05-17 16:54:07.141 1504 1504 I : dev_attr_store+0x38/0x8c
05-17 16:54:07.141 1504 1504 I : sysfs_kf_write+0xa0/0x100
05-17 16:54:07.141 1504 1504 I : kernfs_fop_write_iter+0x1b0/0x2f8

Change-Id: Ib1812c5a1b5b0e2fdb9b620dc26a256b3feb0fcf
Signed-off-by: Wenge Zhu <zhuwg1@motorola.com>
Reviewed-on: https://gerrit.mot.com/2283850
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Tested-by: Jira Key
Submit-Approved: Jira Key
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
This commit is contained in:
Wenge Zhu 2022-05-30 16:48:33 +08:00 • committed by zhuwg1
commit 661042eff0

View file

@ -6698,6 +6698,8 @@ static int cyttsp5_sensor_init(struct cyttsp5_core_data *data)
struct input_dev *sensor_input_dev;
int err;
mutex_init(&data->state_mutex);
sensor_input_dev = input_allocate_device();
if (!sensor_input_dev) {
pr_err("%s: Failed to allocate device", __func__);