[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240626102140.1aac4593@kmaincent-XPS-13-7390>
Date: Wed, 26 Jun 2024 10:21:40 +0200
From: Kory Maincent <kory.maincent@...tlin.com>
To: Sai Krishna Gajula <saikrishnag@...vell.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, Paolo Abeni
<pabeni@...hat.com>, Donald Hunter <donald.hunter@...il.com>, Oleksij
Rempel <o.rempel@...gutronix.de>, Jonathan Corbet <corbet@....net>, Thomas
Petazzoni <thomas.petazzoni@...tlin.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>, Dent Project <dentproject@...uxfoundation.org>,
"kernel@...gutronix.de" <kernel@...gutronix.de>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>
Subject: Re: [PATCH net-next v4 4/7] net: pse-pd: Add new power limit get
and set c33 features
On Tue, 25 Jun 2024 18:49:26 +0000
Sai Krishna Gajula <saikrishnag@...vell.com> wrote:
> > + * Return: 0 on success and failure value on error */ int
> > +pse_ethtool_set_pw_limit(struct pse_control *psec,
> > + struct netlink_ext_ack *extack,
> > + const unsigned int pw_limit)
> > +{
> > + int uV, uA, ret;
> > + s64 tmp_64;
> > +
> > + ret = regulator_get_voltage(psec->ps);
> > + if (!ret) {
> > + NL_SET_ERR_MSG(extack,
> > + "Can't read current voltage");
> > + return ret;
> > + }
> > + if (ret < 0) {
> > + NL_SET_ERR_MSG(extack,
> > + "Error reading current voltage");
> > + return ret;
> > + }
>
> Is there any significance of checking "ret" value against '0' and '< 0'
> separately? Just trying to understand, these checks reflect regulator
> failure etc..?
In fact having ret = 0 is not an error for regulator_get_voltage() but with a 0
value I can't calculate the currrent.
I will update the error message and return value:
NL_SET_ERR_MSG(extack, "Can't calculate the current, PSE voltage read is 0");
return -ERANGE;
> [...]
> Reviewed-by: Sai Krishna <saikrishnag@...vell.com>
Thanks!
Regards,
--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
Powered by blists - more mailing lists