mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
thermal/drivers/ti-soc-thermal: Avoid dereferencing ERR_PTR
[ Upstream commit 7440f518dad9d861d76c64956641eeddd3586f75 ] On error the function ti_bandgap_get_sensor_data() returns the error code in ERR_PTR() but we only checked if the return value is NULL or not. And, so we can dereference an error code inside ERR_PTR. While at it, convert a check to IS_ERR_OR_NULL. Signed-off-by: Sudip Mukherjee <[email protected]> Reviewed-by: Amit Kucheria <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
3296e566b0
commit
ea78361174
1 changed files with 3 additions and 3 deletions
|
|
@ -169,7 +169,7 @@ int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id,
|
|||
|
||||
data = ti_bandgap_get_sensor_data(bgp, id);
|
||||
|
||||
if (!data || IS_ERR(data))
|
||||
if (!IS_ERR_OR_NULL(data))
|
||||
data = ti_thermal_build_data(bgp, id);
|
||||
|
||||
if (!data)
|
||||
|
|
@ -196,7 +196,7 @@ int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
|
|||
|
||||
data = ti_bandgap_get_sensor_data(bgp, id);
|
||||
|
||||
if (data && data->ti_thermal) {
|
||||
if (!IS_ERR_OR_NULL(data) && data->ti_thermal) {
|
||||
if (data->our_zone)
|
||||
thermal_zone_device_unregister(data->ti_thermal);
|
||||
}
|
||||
|
|
@ -262,7 +262,7 @@ int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
|
|||
|
||||
data = ti_bandgap_get_sensor_data(bgp, id);
|
||||
|
||||
if (data) {
|
||||
if (!IS_ERR_OR_NULL(data)) {
|
||||
cpufreq_cooling_unregister(data->cool_dev);
|
||||
if (data->policy)
|
||||
cpufreq_cpu_put(data->policy);
|
||||
|
|
|
|||
Loading…
Reference in a new issue