summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSudeep Holla <Sudeep.Holla@arm.com>2018-04-06 11:30:47 -0400
committerGuenter Roeck <linux@roeck-us.net>2018-04-22 22:39:55 -0400
commitf18a36cf3f31dce633fe2a93d0059008bb21d9f2 (patch)
tree5a4e4154db998158f9c5945fac88b19ffd2e711f
parent6d08b06e67cd117f6992c46611dfb4ce267cd71e (diff)
hwmon: (scmi) handle absence of few types of sensors
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 <james.quinlan@broadcom.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-hwmon@vger.kernel.org Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/scmi-hwmon.c5
1 files changed, 4 insertions, 1 deletions
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)
170 scmi_chip_info.info = ptr_scmi_ci; 170 scmi_chip_info.info = ptr_scmi_ci;
171 chip_info = &scmi_chip_info; 171 chip_info = &scmi_chip_info;
172 172
173 for (type = 0; type < hwmon_max && nr_count[type]; type++) { 173 for (type = 0; type < hwmon_max; type++) {
174 if (!nr_count[type])
175 continue;
176
174 scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type], 177 scmi_hwmon_add_chan_info(scmi_hwmon_chan, dev, nr_count[type],
175 type, hwmon_attributes[type]); 178 type, hwmon_attributes[type]);
176 *ptr_scmi_ci++ = scmi_hwmon_chan++; 179 *ptr_scmi_ci++ = scmi_hwmon_chan++;