]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: pse-pd: Do not return EOPNOSUPP if config is null
authorKory Maincent <kory.maincent@bootlin.com>
Thu, 11 Jul 2024 13:55:18 +0000 (15:55 +0200)
committerJakub Kicinski <kuba@kernel.org>
Sun, 14 Jul 2024 14:16:18 +0000 (07:16 -0700)
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: d83e13761d5b ("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>
drivers/net/pse-pd/pse_core.c
net/ethtool/pse-pd.c

index 795ab264eaf27b79be093845955a6f0cc4c1889f..513cd7f8593370eb9b41f254c679e7c0d1a88973 100644 (file)
@@ -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;
index 2c981d443f27ed7a77379456ac039368d7e5cdf9..982995ff16280ac89de65a5373127d3a234bba00 100644 (file)
@@ -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);
 }