Currently the loop checks for non-zero count of sensors for each type
of sensors which is completely wrong. It also results in aborting the
registration of sensors if one or more types of sensors are completely
not supported by the platform SCMI firmware.

This patch fixes the issue by continue to loop and skiping sensor types
that are not present.

Fixes: b23688aefb8b ("hwmon: add support for sensors exported via ARM SCMI")
Reported-by: Jim Quinlan <>
Cc: Guenter Roeck <>
Signed-off-by: Sudeep Holla <>
 drivers/hwmon/scmi-hwmon.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index 363bf56eb0f2..91976b6ca300 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -170,7 +170,10 @@ static int scmi_hwmon_probe(struct scmi_device *sdev) = ptr_scmi_ci;
        chip_info = &scmi_chip_info;
-       for (type = 0; type < hwmon_max && nr_count[type]; type++) {
+       for (type = 0; type < hwmon_max; type++) {
+               if (!nr_count[type])
+                       continue;
                scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type],
                                         type, hwmon_attributes[type]);
                *ptr_scmi_ci++ = scmi_hwmon_chan++;

To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to
More majordomo info at

Reply via email to