From 51ea7ea97cb4a5390c5d62c682f545424cf98c98 Mon Sep 17 00:00:00 2001 From: litong Date: Wed, 25 Dec 2019 10:53:56 +0800 Subject: [PATCH] Racer5G: system crash when Synaptics shut dowm TP: Solve the problem of system crash when the synaptics touch is shut down. Change-Id: I2e483d2a1ff27cb5a2607611843c414dddd87fa9 Reviewed-on: https://gerrit.mot.com/1476476 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Jialei Hao Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- .../touchscreen/synaptics_tcm_mmi_v2/synaptics_core.h | 5 +++-- .../touchscreen/synaptics_tcm_mmi_v2/synaptics_recovery.c | 3 +-- .../touchscreen/synaptics_tcm_mmi_v2/synaptics_reflash.c | 7 +++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_core.h b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_core.h index 1e0b7fd2f705..ed8073f942d8 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_core.h +++ b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_core.h @@ -94,7 +94,8 @@ #define INIT_BUFFER(buffer, is_clone) \ mutex_init(&buffer.buf_mutex); \ - buffer.clone = is_clone + buffer.clone = is_clone; \ + buffer.buf_size = 0 #define LOCK_BUFFER(buffer) \ mutex_lock(&buffer.buf_mutex) @@ -104,7 +105,7 @@ #define RELEASE_BUFFER(buffer) \ do { \ - if (buffer.clone == false) { \ + if (buffer.clone == false && (buffer.buf_size != 0)) { \ kfree(buffer.buf); \ buffer.buf_size = 0; \ buffer.data_length = 0; \ diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_recovery.c b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_recovery.c index ffcd8e4a0407..064d106cdeb7 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_recovery.c +++ b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_recovery.c @@ -1267,9 +1267,8 @@ static int recovery_remove(struct syna_tcm_hcd *tcm_hcd) kobject_put(recovery_hcd->sysfs_dir); } - kfree(recovery_hcd->data_buf); - kfree(recovery_hcd->ihex_buf); + vfree(recovery_hcd->ihex_buf); kfree(recovery_hcd); recovery_hcd = NULL; diff --git a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_reflash.c b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_reflash.c index 081e4f96e681..4ec5be78584a 100644 --- a/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_reflash.c +++ b/drivers/input/touchscreen/synaptics_tcm_mmi_v2/synaptics_reflash.c @@ -2536,14 +2536,13 @@ static int reflash_remove(struct syna_tcm_hcd *tcm_hcd) flush_workqueue(reflash_hcd->workqueue); destroy_workqueue(reflash_hcd->workqueue); #endif - - kfree(reflash_hcd->image_buf); + if (reflash_hcd->image_buf) + kfree(reflash_hcd->image_buf); RELEASE_BUFFER(reflash_hcd->read); RELEASE_BUFFER(reflash_hcd->resp); RELEASE_BUFFER(reflash_hcd->out); - - kfree(reflash_hcd); + vfree(reflash_hcd); reflash_hcd = NULL; exit: