mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
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: 54076cb3b5
("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>
This commit is contained in:
parent
a165dcc923
commit
8e6af45411
@ -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++;
|
||||
}
|
||||
|
||||
s = sensors->power.num_sensors + 1;
|
||||
}
|
||||
|
||||
if (sensors->caps.num_sensors >= 1) {
|
||||
s = sensors->power.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);
|
||||
|
Loading…
Reference in New Issue
Block a user