* [PATCH] hwmon: (scmi) handle absence of few types of sensors
@ 2018-04-06 15:30 Sudeep Holla
2018-04-10 20:14 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Sudeep Holla @ 2018-04-06 15:30 UTC (permalink / raw)
To: linux-kernel, Guenter Roeck; +Cc: Sudeep Holla, Jim Quinlan, linux-hwmon
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>
---
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)
scmi_chip_info.info = 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++;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (scmi) handle absence of few types of sensors
2018-04-06 15:30 [PATCH] hwmon: (scmi) handle absence of few types of sensors Sudeep Holla
@ 2018-04-10 20:14 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2018-04-10 20:14 UTC (permalink / raw)
To: Sudeep Holla; +Cc: linux-kernel, Jim Quinlan, linux-hwmon
On Fri, Apr 06, 2018 at 04:30:47PM +0100, Sudeep Holla wrote:
> 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>
Applied.
Thanks,
Guenter
> ---
> 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)
> scmi_chip_info.info = 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++;
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-04-10 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-06 15:30 [PATCH] hwmon: (scmi) handle absence of few types of sensors Sudeep Holla
2018-04-10 20:14 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.