lkml.org 
[lkml]   [2015]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] thermal: ti-soc-thermal: fix error check
On Mon, Nov 23, 2015 at 06:24:41PM +0530, Sudip Mukherjee wrote:
> We were only checking if data is not NULL but
> ti_bandgap_get_sensor_data() can return NULL or ERR_PTR.

Do you have a fail case? Can you please send the logs too?

>
> Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
> ---
> drivers/thermal/ti-soc-thermal/ti-thermal-common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> index b213a12..d76bb7c 100644
> --- a/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> +++ b/drivers/thermal/ti-soc-thermal/ti-thermal-common.c
> @@ -365,7 +365,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) {

I don t really see the need for this as we always
ti_bandgap_set_sensor_data with a valid pointer, never with a ERR PTR.
So, it would be either valid or NULL.

> if (data->our_zone)
> thermal_zone_device_unregister(data->ti_thermal);
> else
> --
> 1.9.1
>


\
 
 \ /
  Last update: 2015-11-24 01:01    [W:0.046 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site