lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYmEctaGrQ578xfD@carl-amd>
Date: Mon, 9 Feb 2026 14:53:38 +0800
From: Carl Lee <qq1145099@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Charles Hsu <ythsu0511@...il.com>, linux-hwmon@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	peter.shen@....com, colin.huang2@....com
Subject: Re: [PATCH v2 3/3] hwmon: pmbus: mpq8785: force direct mode for VID
 VOUT on MPQ8785/MPQ8786

On Thu, Feb 05, 2026 at 09:46:05AM -0800, Guenter Roeck wrote:
> On Thu, Feb 05, 2026 at 06:01:39PM +0800, Carl Lee via B4 Relay wrote:
> > From: Carl Lee <carl.lee@....com>
> > 
> > According to MPQ8785/MPQ8786 datasheet, VID mode configuration is
> > the same as direct mode configuration. Therefore, when VOUT is
> > reported in VID mode, it must be forced to use direct format.
> > 
> > Signed-off-by: Carl Lee <carl.lee@....com>
> > ---
> >  drivers/hwmon/pmbus/mpq8785.c | 20 ++++++++++++++++++++
> >  1 file changed, 20 insertions(+)
> > 
> > diff --git a/drivers/hwmon/pmbus/mpq8785.c b/drivers/hwmon/pmbus/mpq8785.c
> > index f35534836cb8..d6624af076c3 100644
> > --- a/drivers/hwmon/pmbus/mpq8785.c
> > +++ b/drivers/hwmon/pmbus/mpq8785.c
> > @@ -48,6 +48,25 @@ static int mpq8785_identify(struct i2c_client *client,
> >  	return 0;
> >  };
> >  
> > +static int mpq8785_read_byte_data(struct i2c_client *client, int page, int reg)
> > +{
> > +	int ret;
> > +
> > +	switch (reg) {
> > +	case PMBUS_VOUT_MODE:
> > +		ret = pmbus_read_byte_data(client, page, reg);
> > +		if (ret < 0)
> > +			return ret;
> > +
> > +		if ((ret >> 5) == 1)
> > +			return PB_VOUT_MODE_DIRECT;
> > +	default:
> > +		return -ENODATA;
> > +	}
> > +
> > +	return ret;
> > +}
> 
> In addition to my earlier reply, here is AI code review feedback:
> 
> This switch statement appears to fall through to the default case when the
> mode is not VID (when (ret >> 5) != 1). If it falls through, it returns
> -ENODATA.  The core function _pmbus_read_byte_data() will then see -ENODATA
> and call pmbus_read_byte_data() again, resulting in a second I2C transaction
> for the same register.
> 
> Also, the `return ret;` at the end of the function is unreachable because
> the default case returns.
> 
> Should the PMBUS_VOUT_MODE case return `ret` instead of falling through?
> 
> Guenter

Got it, I’ll correct this.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ