Patch "hwmon: (pmbus) Initialise page count in pmbus_identify()" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hwmon: (pmbus) Initialise page count in pmbus_identify()

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hwmon-pmbus-initialise-page-count-in-pmbus_identify.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 1541836d6e8d02bcbbdc7c9479eef44c43399d50
Author: Titus Rwantare <titusr@xxxxxxxxxx>
Date:   Thu Feb 27 22:24:55 2025 +0000

    hwmon: (pmbus) Initialise page count in pmbus_identify()
    
    [ Upstream commit 6b6e2e8fd0de3fa7c6f4f8fe6841b01770b2e7bc ]
    
    The `pmbus_identify()` function fails to correctly determine the number
    of supported pages on PMBus devices. This occurs because `info->pages`
    is implicitly zero-initialised, and `pmbus_set_page()` does not perform
    writes to the page register if `info->pages` is not yet initialised.
    Without this patch, `info->pages` is always set to the maximum after
    scanning.
    
    This patch initialises `info->pages` to `PMBUS_PAGES` before the probing
    loop, enabling `pmbus_set_page()` writes to make it out onto the bus
    correctly identifying the number of pages. `PMBUS_PAGES` seemed like a
    reasonable non-zero number because that's the current result of the
    identification process.
    
    Testing was done with a PMBus device in QEMU.
    
    Signed-off-by: Titus Rwantare <titusr@xxxxxxxxxx>
    Fixes: 442aba78728e7 ("hwmon: PMBus device driver")
    Link: https://lore.kernel.org/r/20250227222455.2583468-1-titusr@xxxxxxxxxx
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/hwmon/pmbus/pmbus.c b/drivers/hwmon/pmbus/pmbus.c
index d0d386990af5e..6366610a90827 100644
--- a/drivers/hwmon/pmbus/pmbus.c
+++ b/drivers/hwmon/pmbus/pmbus.c
@@ -103,6 +103,8 @@ static int pmbus_identify(struct i2c_client *client,
 		if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) {
 			int page;
 
+			info->pages = PMBUS_PAGES;
+
 			for (page = 1; page < PMBUS_PAGES; page++) {
 				if (pmbus_set_page(client, page, 0xff) < 0)
 					break;




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux