Skip to content

Commit

Permalink
net: pse-pd: Do not return EOPNOSUPP if config is null
Browse files Browse the repository at this point in the history
For a PSE supporting both c33 and PoDL, setting config for one type of PoE
leaves the other type's config null. Currently, this case returns
EOPNOTSUPP, which is incorrect. Instead, we should do nothing if the
configuration is empty.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Fixes: d83e137 ("net: pse-pd: Use regulator framework within PSE framework")
Link: https://patch.msgid.link/20240711-fix_pse_pd_deref-v3-1-edd78fc4fe42@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
kmaincent authored and kuba-moo committed Jul 14, 2024
1 parent 70c676c commit 93c3a96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/net/pse-pd/pse_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -719,13 +719,13 @@ int pse_ethtool_set_config(struct pse_control *psec,
{
int err = 0;

if (pse_has_c33(psec)) {
if (pse_has_c33(psec) && config->c33_admin_control) {
err = pse_ethtool_c33_set_config(psec, config);
if (err)
return err;
}

if (pse_has_podl(psec))
if (pse_has_podl(psec) && config->podl_admin_control)
err = pse_ethtool_podl_set_config(psec, config);

return err;
Expand Down
4 changes: 3 additions & 1 deletion net/ethtool/pse-pd.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ ethnl_set_pse(struct ethnl_req_info *req_info, struct genl_info *info)
if (pse_has_c33(phydev->psec))
config.c33_admin_control = nla_get_u32(tb[ETHTOOL_A_C33_PSE_ADMIN_CONTROL]);

/* Return errno directly - PSE has no notification */
/* Return errno directly - PSE has no notification
* pse_ethtool_set_config() will do nothing if the config is null
*/
return pse_ethtool_set_config(phydev->psec, info->extack, &config);
}

Expand Down

0 comments on commit 93c3a96

Please sign in to comment.