staging: omap-thermal: fix error checking
authorEduardo Valentin <eduardo.valentin@ti.com>
Fri, 15 Mar 2013 12:59:54 +0000 (08:59 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Mar 2013 16:02:08 +0000 (09:02 -0700)
The omap_bandgap_get_sensor_data() function returns ERR_PTR(),
but it can also return NULL, in case of initilization, so we need to use
IS_ERR_OR_NULL() rather than only IS_ERR().

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/omap-thermal/omap-thermal-common.c

index 79a55aaae5a3aef7e9682dfb2b3543611dd97e1f..8aebc6a12c40722e19ef378583febde7c23f36b9 100644 (file)
@@ -260,7 +260,7 @@ int omap_thermal_expose_sensor(struct omap_bandgap *bg_ptr, int id,
 
        data = omap_bandgap_get_sensor_data(bg_ptr, id);
 
-       if (IS_ERR(data))
+       if (IS_ERR_OR_NULL(data))
                data = omap_thermal_build_data(bg_ptr, id);
 
        if (!data)
@@ -309,7 +309,7 @@ int omap_thermal_register_cpu_cooling(struct omap_bandgap *bg_ptr, int id)
        struct omap_thermal_data *data;
 
        data = omap_bandgap_get_sensor_data(bg_ptr, id);
-       if (IS_ERR(data))
+       if (IS_ERR_OR_NULL(data))
                data = omap_thermal_build_data(bg_ptr, id);
 
        if (!data)