thermal/drivers/ti-soc-thermal: Avoid dereferencing ERR_PTR
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>
Fri, 24 Apr 2020 16:19:44 +0000 (17:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:50:23 +0000 (17:50 +0200)
commitea78361174c4746e8df8e6fdc0ec1dc710a6869d
tree39afdc048a4b3f9a9315f1a1991cc0aaae9c26dc
parent3296e566b0d26d47f19163e238ea85f20c2dbd90
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 <sudipm.mukherjee@gmail.com>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200424161944.6044-1-sudipm.mukherjee@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/thermal/ti-soc-thermal/ti-thermal-common.c