]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hwmon: (pmbus/adm1266) don't clobber GPIO bits before PDIO read in get_multiple
authorAbdurrahman Hussain <abdurrahman@nexthop.ai>
Tue, 19 May 2026 00:52:26 +0000 (17:52 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 21 May 2026 13:59:22 +0000 (06:59 -0700)
commit3327a12aee9e10ffa903e28b8445dfd1af5307c0
treea259b5a22ffac392e221a145021c92be7de292e8
parentd7834d92251baade796812876e95555e2066fa9f
hwmon: (pmbus/adm1266) don't clobber GPIO bits before PDIO read in get_multiple

adm1266_gpio_get_multiple() zeroes *bits before the GPIO_STATUS loop
and then a second time before the PDIO_STATUS loop:

*bits = 0;
for_each_set_bit(gpio_nr, mask, ADM1266_GPIO_NR) {
...
set_bit(gpio_nr, bits);
}

ret = i2c_smbus_read_block_data(data->client, ADM1266_PDIO_STATUS, ...);
...
*bits = 0;
for_each_set_bit_from(gpio_nr, mask, ADM1266_GPIO_NR + ADM1266_PDIO_NR) {
...
set_bit(gpio_nr, bits);
}

The second *bits = 0 throws away every GPIO bit the first loop just
populated, so callers asking for any combination of GPIO and PDIO
pins always see the GPIO portion of the returned bits as zero.

Drop the redundant second assignment so both halves of the result
survive.

Fixes: d98dfad35c38 ("hwmon: (pmbus/adm1266) Add support for GPIOs")
Cc: stable@vger.kernel.org
Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-2-e425e4f88139@nexthop.ai
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/adm1266.c