thermal/drivers/tsens: Fix wrong check for tzd in irq handlers
authorAnsuel Smith <ansuelsmth@gmail.com>
Tue, 7 Sep 2021 21:25:42 +0000 (23:25 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 21 Sep 2021 13:17:11 +0000 (15:17 +0200)
Some devices can have some thermal sensors disabled from the
factory. The current two irq handler functions check all the sensor by
default and the check if the sensor was actually registered is
wrong. The tzd is actually never set if the registration fails hence
the IS_ERR check is wrong.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20210907212543.20220-1-ansuelsmth@gmail.com
drivers/thermal/qcom/tsens.c

index 4c7ebd1d3f9c9537f89722f25d5962e58155c6b6..b1162e566a707d6489431bba18abbb893e57c401 100644 (file)
@@ -417,7 +417,7 @@ static irqreturn_t tsens_critical_irq_thread(int irq, void *data)
                const struct tsens_sensor *s = &priv->sensor[i];
                u32 hw_id = s->hw_id;
 
-               if (IS_ERR(s->tzd))
+               if (!s->tzd)
                        continue;
                if (!tsens_threshold_violated(priv, hw_id, &d))
                        continue;
@@ -467,7 +467,7 @@ static irqreturn_t tsens_irq_thread(int irq, void *data)
                const struct tsens_sensor *s = &priv->sensor[i];
                u32 hw_id = s->hw_id;
 
-               if (IS_ERR(s->tzd))
+               if (!s->tzd)
                        continue;
                if (!tsens_threshold_violated(priv, hw_id, &d))
                        continue;