thermal/drivers/qcom/spmi-adc-tm5: Don't abort probing if a sensor is not used
authorMatthias Kaehlcke <>
Mon, 23 Aug 2021 20:47:30 +0000 (13:47 -0700)
committerDaniel Lezcano <>
Thu, 9 Sep 2021 14:33:29 +0000 (16:33 +0200)
adc_tm5_register_tzd() registers the thermal zone sensors for all
channels of the thermal monitor. If the registration of one channel
fails the function skips the processing of the remaining channels
and returns an error, which results in _probe() being aborted.

One of the reasons the registration could fail is that none of the
thermal zones is using the channel/sensor, which hardly is a critical
error (if it is an error at all). If this case is detected emit a
warning and continue with processing the remaining channels.

Fixes: ca66dca5eda6 ("thermal: qcom: add support for adc-tm5 PMIC thermal monitor")
Signed-off-by: Matthias Kaehlcke <>
Reported-by: Stephen Boyd <>
Reviewed-by: Stephen Boyd <>
Reviewed-by: Dmitry Baryshkov <>
Signed-off-by: Daniel Lezcano <>

index 232fd0b..8494cc0 100644 (file)
@@ -359,6 +359,12 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
                if (IS_ERR(tzd)) {
+                       if (PTR_ERR(tzd) == -ENODEV) {
+                               dev_warn(adc_tm->dev, "thermal sensor on channel %d is not used\n",
+                                        adc_tm->channels[i].channel);
+                               continue;
+                       }
                        dev_err(adc_tm->dev, "Error registering TZ zone for channel %d: %ld\n",
                                adc_tm->channels[i].channel, PTR_ERR(tzd));
                        return PTR_ERR(tzd);