From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F4A233D9E; Sat, 30 May 2026 18:18:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165105; cv=none; b=lyLMRBhPLmzV/lciK55bcsvShzs/tsQWyQUOkZn4kne0h4I8VxQVc//ujhJOktOvKb44YZALrdxdLoSekDUNlxzdFY/h5AFgFTdLgB7AgpqaqcG4DdqAt2/kqzVNyPKEA66OMK1mCtnfp7+iF0/LGO5CCfHfZEtvbf9h1QafYwQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780165105; c=relaxed/simple; bh=gqzD6hm3n+J7qvM29jbo5jjfCozTP/khLe11QM3UZHo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kEcQ7XXlv8crr+X97+LOwAJU+qWiiedaoD+0TXJq7QTFu1c2mfJciNZw3D6lQvnrCU4dHvcEmCO2NKxc9C2LknwV1lDRerUgrnAUeU8thLOUIEGS4t0FjCoMQpF31r5pT2+PVGmJESrabE2jj6X7/sMC3qDx9/yOVOJ0DAhMmmA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=A6h2nRN/; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="A6h2nRN/" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E56621F00893; Sat, 30 May 2026 18:18:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780165104; bh=dJkFfmTCh3zOE++tiOuQ4kP4e9HWYbDj2c+jO9mKT20=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=A6h2nRN/GgE25s7FJusHHCudyVXnxeOzqzRrcJIlXHDpgziEuKMJbLUc+O5fjJlT0 J4Ps7yc3fMfk3q7u5LKqEQlNrl1+ud03fnx0A4bZM0Jj9FwEaZY7gtnO/0RdH1cTub jGCjnw8g4fzstVWkfvi2cZS3/JVHRkNVpwZ+HEOM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abdurrahman Hussain , Bartosz Golaszewski , Linus Walleij , Guenter Roeck Subject: [PATCH 5.15 721/776] hwmon: (pmbus/adm1266) dont clobber GPIO bits before PDIO read in get_multiple Date: Sat, 30 May 2026 18:07:15 +0200 Message-ID: <20260530160258.451405602@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Abdurrahman Hussain commit 3327a12aee9e10ffa903e28b8445dfd1af5307c0 upstream. 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 Reviewed-by: Bartosz Golaszewski Reviewed-by: Linus Walleij Link: https://lore.kernel.org/r/20260518-adm1266-gpio-fixes-v3-2-e425e4f88139@nexthop.ai Signed-off-by: Guenter Roeck Signed-off-by: Greg Kroah-Hartman --- drivers/hwmon/pmbus/adm1266.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/hwmon/pmbus/adm1266.c +++ b/drivers/hwmon/pmbus/adm1266.c @@ -211,7 +211,6 @@ static int adm1266_gpio_get_multiple(str status = read_buf[0] + (read_buf[1] << 8); - *bits = 0; for_each_set_bit_from(gpio_nr, mask, ADM1266_GPIO_NR + ADM1266_PDIO_NR) { if (test_bit(gpio_nr - ADM1266_GPIO_NR, &status)) set_bit(gpio_nr, bits);