Skip to content

Commit 8e6af45

Browse files
Eddie Jamesgroeck
authored andcommitted
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: 54076cb ("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>
1 parent a165dcc commit 8e6af45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/hwmon/occ/common.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,8 @@ static int occ_setup_sensor_attrs(struct occ *occ)
890890
s++;
891891
}
892892
}
893+
894+
s = (sensors->power.num_sensors * 4) + 1;
893895
} else {
894896
for (i = 0; i < sensors->power.num_sensors; ++i) {
895897
s = i + 1;
@@ -918,11 +920,11 @@ static int occ_setup_sensor_attrs(struct occ *occ)
918920
show_power, NULL, 3, i);
919921
attr++;
920922
}
921-
}
922923

923-
if (sensors->caps.num_sensors >= 1) {
924924
s = sensors->power.num_sensors + 1;
925+
}
925926

927+
if (sensors->caps.num_sensors >= 1) {
926928
snprintf(attr->name, sizeof(attr->name), "power%d_label", s);
927929
attr->sensor = OCC_INIT_ATTR(attr->name, 0444, show_caps, NULL,
928930
0, 0);

0 commit comments

Comments
 (0)