diff options
author | Eddie James <eajames@linux.ibm.com> | 2019-03-19 16:01:58 -0500 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2019-03-29 09:51:44 -0700 |
commit | 8e6af454117a51dbf6c8a47c00180a0c235052fe (patch) | |
tree | 0bab954ac8f6a520f0df8b9f5bfc492c32d7a45a /drivers | |
parent | a165dcc923ada2ffdee1d4f41f12f81b66d04c55 (diff) | |
download | linux-8e6af454117a51dbf6c8a47c00180a0c235052fe.tar.bz2 |
hwmon: (occ) Fix power sensor indexing
In the case of power sensor version 0xA0, the sensor indexing overlapped
with the "caps" power sensors, resulting in probe failure and kernel
warnings. Fix this by specifying the next index for each power sensor
version.
Fixes: 54076cb3b5ff ("hwmon (occ): Add sensor attributes and register ...")
Cc: stable@vger.kernel.org
Signed-off-by: Eddie James <eajames@linux.ibm.com>
Tested-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/hwmon/occ/common.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c index b91a80abf724..4679acb4918e 100644 --- a/drivers/hwmon/occ/common.c +++ b/drivers/hwmon/occ/common.c @@ -890,6 +890,8 @@ static int occ_setup_sensor_attrs(struct occ *occ) s++; } } + + s = (sensors->power.num_sensors * 4) + 1; } else { for (i = 0; i < sensors->power.num_sensors; ++i) { s = i + 1; @@ -918,11 +920,11 @@ static int occ_setup_sensor_attrs(struct occ *occ) show_power, NULL, 3, i); attr++; } - } - if (sensors->caps.num_sensors >= 1) { s = sensors->power.num_sensors + 1; + } + if (sensors->caps.num_sensors >= 1) { snprintf(attr->name, sizeof(attr->name), "power%d_label", s); attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL, 0, 0); |