From e250309ddc18f9e772781c8e98c3930aeb58bee1 Mon Sep 17 00:00:00 2001 From: hujing3 Date: Tue, 11 Dec 2018 14:47:34 +0800 Subject: [PATCH] arm64/dts: surf ft tp update surfNA: focaltech tp driver update fix NULL pointer crash issue Change-Id: I7154ae202f09fc622a88e28411841db8c211102a Signed-off-by: hujing3 Reviewed-on: https://gerrit.mot.com/1281380 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Xiangpo Zhao Submit-Approved: Jira Key --- .../touchscreen/focaltech_mmi/focaltech_ts.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c b/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c index 3794fcbd6805..6b79f97ecfea 100644 --- a/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c +++ b/drivers/input/touchscreen/focaltech_mmi/focaltech_ts.c @@ -1158,23 +1158,31 @@ static int ft_power_init(struct ft_ts_data *data, bool on) reg_vcc_i2c_put: regulator_put(data->vcc_i2c); + data->vcc_i2c = NULL; reg_vdd_set_vtg: if (regulator_count_voltages(data->vdd) > 0) regulator_set_voltage(data->vdd, 0, FT_VTG_MAX_UV); reg_vdd_put: regulator_put(data->vdd); + data->vdd = NULL; + return rc; pwr_deinit: - if (regulator_count_voltages(data->vdd) > 0) - regulator_set_voltage(data->vdd, 0, FT_VTG_MAX_UV); + if (!IS_ERR_OR_NULL(data->vdd)) { + if (regulator_count_voltages(data->vdd) > 0) + regulator_set_voltage(data->vdd, 0, FT_VTG_MAX_UV); - regulator_put(data->vdd); + regulator_put(data->vdd); + } - if (regulator_count_voltages(data->vcc_i2c) > 0) - regulator_set_voltage(data->vcc_i2c, 0, FT_I2C_VTG_MAX_UV); + if (!IS_ERR_OR_NULL(data->vcc_i2c)) { + if (regulator_count_voltages(data->vcc_i2c) > 0) + regulator_set_voltage(data->vcc_i2c, 0, FT_I2C_VTG_MAX_UV); + + regulator_put(data->vcc_i2c); + } - regulator_put(data->vcc_i2c); return 0; }