Re: [PATCH net-next v4 4/7] net: pse-pd: Add new power limit get and set c33 features
From: Kory Maincent <kory.maincent@bootlin.com>
Date: 2024-06-26 08:21:50
Also in:
linux-doc, lkml
From: Kory Maincent <kory.maincent@bootlin.com>
Date: 2024-06-26 08:21:50
Also in:
linux-doc, lkml
On Tue, 25 Jun 2024 18:49:26 +0000 Sai Krishna Gajula [off-list ref] wrote:
quoted
+ * 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 <redacted>
Thanks! Regards, -- Köry Maincent, Bootlin Embedded Linux and kernel engineering https://bootlin.com