Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux

Pull thermal fixes from Zhang Rui:

- fix NULL pointer dereference on module load/probe for int3403_thermal
driver

- fix an emergency shutdown issue on exynos thermal driver

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
thermal: exynos: Propagate error value from tmu_read()
thermal: exynos: Reading temperature makes sense only when TMU is turned on
thermal: int3403_thermal: Fix NULL pointer deref on module load / probe

+12 -5
+1 -2
drivers/thermal/int340x_thermal/int3403_thermal.c
··· 194 194 return -EFAULT; 195 195 } 196 196 197 + priv->priv = obj; 197 198 obj->max_state = p->package.count - 1; 198 199 obj->cdev = 199 200 thermal_cooling_device_register(acpi_device_bid(priv->adev), 200 201 priv, &int3403_cooling_ops); 201 202 if (IS_ERR(obj->cdev)) 202 203 result = PTR_ERR(obj->cdev); 203 - 204 - priv->priv = obj; 205 204 206 205 kfree(buf.pointer); 207 206 /* TODO: add ACPI notification support */
+11 -3
drivers/thermal/samsung/exynos_tmu.c
··· 185 185 * @regulator: pointer to the TMU regulator structure. 186 186 * @reg_conf: pointer to structure to register with core thermal. 187 187 * @ntrip: number of supported trip points. 188 + * @enabled: current status of TMU device 188 189 * @tmu_initialize: SoC specific TMU initialization method 189 190 * @tmu_control: SoC specific TMU control method 190 191 * @tmu_read: SoC specific TMU temperature read method ··· 206 205 struct regulator *regulator; 207 206 struct thermal_zone_device *tzd; 208 207 unsigned int ntrip; 208 + bool enabled; 209 209 210 210 int (*tmu_initialize)(struct platform_device *pdev); 211 211 void (*tmu_control)(struct platform_device *pdev, bool on); ··· 400 398 mutex_lock(&data->lock); 401 399 clk_enable(data->clk); 402 400 data->tmu_control(pdev, on); 401 + data->enabled = on; 403 402 clk_disable(data->clk); 404 403 mutex_unlock(&data->lock); 405 404 } ··· 892 889 static int exynos_get_temp(void *p, int *temp) 893 890 { 894 891 struct exynos_tmu_data *data = p; 892 + int value, ret = 0; 895 893 896 - if (!data || !data->tmu_read) 894 + if (!data || !data->tmu_read || !data->enabled) 897 895 return -EINVAL; 898 896 899 897 mutex_lock(&data->lock); 900 898 clk_enable(data->clk); 901 899 902 - *temp = code_to_temp(data, data->tmu_read(data)) * MCELSIUS; 900 + value = data->tmu_read(data); 901 + if (value < 0) 902 + ret = value; 903 + else 904 + *temp = code_to_temp(data, value) * MCELSIUS; 903 905 904 906 clk_disable(data->clk); 905 907 mutex_unlock(&data->lock); 906 908 907 - return 0; 909 + return ret; 908 910 } 909 911 910 912 #ifdef CONFIG_THERMAL_EMULATION