From 9b7dfe02f60f3a603374d973d4f52473a68caf80 Mon Sep 17 00:00:00 2001 From: Manaf Meethalavalappu Pallikunhi Date: Sat, 15 Aug 2020 22:03:45 +0530 Subject: [PATCH] drivers: thermal: don't reset ops pointer in of-thermal sensor unregister The thermal zone ops pointer is allocated and initialized during building thermal zone at early boot. The framework expects this variable is valid as long as that thermal zone exist. Later if a sensor is registered to thermal zone and then unregistered the same due to some reason, it resets this thermal zone ops variable. It leads to unexpected behaviour whenever thermal framework tries to use it. Don't reset thermal zone ops variable during of-thermal sensor unregister context. Change-Id: I468cdfe08f4cde3fb1258ca335fe2ee8b457e014 Signed-off-by: Manaf Meethalavalappu Pallikunhi --- drivers/thermal/of-thermal.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/thermal/of-thermal.c b/drivers/thermal/of-thermal.c index 7995f433799f..0387a2f105ce 100644 --- a/drivers/thermal/of-thermal.c +++ b/drivers/thermal/of-thermal.c @@ -1021,7 +1021,6 @@ void thermal_zone_of_sensor_unregister(struct device *dev, pos_tzd->ops->get_temp = NULL; pos_tzd->ops->get_trend = NULL; pos_tzd->ops->set_emul_temp = NULL; - pos_tzd->ops = NULL; mutex_unlock(&pos_tzd->lock); } kfree(sens_param->tz_list);