mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pradhan, Sanman" <sanman.pradhan@hpe.com>
To: "linux-hwmon@vger.kernel.org" <linux-hwmon@vger.kernel.org>
Cc: "linux@roeck-us.net" <linux@roeck-us.net>,
	"Delphine_CC_Chiu@Wiwynn.com" <Delphine_CC_Chiu@Wiwynn.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sanman Pradhan <psanman@juniper.net>
Subject: [PATCH 3/4] hwmon: (pxe1610) Check return value of page-select write in probe
Date: Sun, 29 Mar 2026 17:09:48 +0000	[thread overview]
Message-ID: <20260329170925.34581-4-sanman.pradhan@hpe.com> (raw)
In-Reply-To: <20260329170925.34581-1-sanman.pradhan@hpe.com>

From: Sanman Pradhan <psanman@juniper.net>

pxe1610_probe() writes PMBUS_PAGE to select page 0 but does not check
the return value. If the write fails, subsequent register reads operate
on an indeterminate page, leading to silent misconfiguration.

Check the return value and propagate the error using dev_err_probe(),
which also handles -EPROBE_DEFER correctly without log spam.

Fixes: 28ccdfd11344 ("hwmon: (pmbus) Add Infineon PXE1610 VR driver")
Signed-off-by: Sanman Pradhan <psanman@juniper.net>
---
 drivers/hwmon/pmbus/pxe1610.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/pmbus/pxe1610.c b/drivers/hwmon/pmbus/pxe1610.c
index 6a4a978eca7e..24c1f961c766 100644
--- a/drivers/hwmon/pmbus/pxe1610.c
+++ b/drivers/hwmon/pmbus/pxe1610.c
@@ -104,7 +104,10 @@ static int pxe1610_probe(struct i2c_client *client)
 	 * By default this device doesn't boot to page 0, so set page 0
 	 * to access all pmbus registers.
 	 */
-	i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
+	ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
+	if (ret < 0)
+		return dev_err_probe(&client->dev, ret,
+				     "Failed to set page 0\n");
 
 	/* Read Manufacturer id */
 	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
-- 
2.34.1


  parent reply	other threads:[~2026-03-29 17:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 17:09 [PATCH 0/4] hwmon: PMBus driver bug fixes Pradhan, Sanman
2026-03-29 17:09 ` [PATCH 1/4] hwmon: (tps53679) Fix array access with zero-length block read Pradhan, Sanman
2026-03-29 19:10   ` Guenter Roeck
2026-03-29 17:09 ` [PATCH 2/4] hwmon: (tps53679) Fix device ID comparison and printing in tps53676_identify() Pradhan, Sanman
2026-03-29 18:34   ` Guenter Roeck
2026-03-29 17:09 ` Pradhan, Sanman [this message]
2026-03-29 19:13   ` [PATCH 3/4] hwmon: (pxe1610) Check return value of page-select write in probe Guenter Roeck
2026-03-29 17:09 ` [PATCH 4/4] hwmon: (ltc4286) Add missing MODULE_IMPORT_NS("PMBUS") Pradhan, Sanman
2026-03-29 19:13   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260329170925.34581-4-sanman.pradhan@hpe.com \
    --to=sanman.pradhan@hpe.com \
    --cc=Delphine_CC_Chiu@Wiwynn.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=psanman@juniper.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®