From 661042eff0fe2e5b48388ec86c99b67107ead00d Mon Sep 17 00:00:00 2001 From: Wenge Zhu Date: Mon, 30 May 2022 16:48:33 +0800 Subject: [PATCH] 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 Reviewed-on: https://gerrit.mot.com/2283850 Reviewed-by: Jichao Zou Tested-by: Jira Key Submit-Approved: Jira Key SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver --- drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_core.c b/drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_core.c index a6fae05e497e..f43427c46b36 100644 --- a/drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_core.c +++ b/drivers/input/touchscreen/parade_tma5xx_mmi/cyttsp5_core.c @@ -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__);