[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y7mt8IUUbMv6bt5v@lunn.ch>
Date: Sat, 7 Jan 2023 18:37:52 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Piergiorgio Beruto <piergiorgio.beruto@...il.com>
Cc: Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Oleksij Rempel <o.rempel@...gutronix.de>,
mailhol.vincent@...adoo.fr, sudheer.mogilappagari@...el.com,
sbhatta@...vell.com, linux-doc@...r.kernel.org,
wangjie125@...wei.com, corbet@....net, lkp@...el.com,
gal@...dia.com, gustavoars@...nel.org
Subject: Re: [PATCH v2 net-next 3/5] drivers/net/phy: add connection between
ethtool and phylib for PLCA
> + // if not enabling PLCA, skip a few sanity checks
> + if (plca_cfg->enabled <= 0)
> + goto apply_cfg;
> +
> + if (!linkmode_test_bit(ETHTOOL_LINK_MODE_10baseT1S_P2MP_Half_BIT,
> + phydev->advertising)) {
> + ret = -EOPNOTSUPP;
> + NL_SET_ERR_MSG(extack,
> + "Point to Multi-Point mode is not enabled");
> + }
> +
> + // allow setting node_id concurrently with enabled
> + if (plca_cfg->node_id >= 0)
> + curr_plca_cfg->node_id = plca_cfg->node_id;
> +
> + if (curr_plca_cfg->node_id >= 255) {
> + NL_SET_ERR_MSG(extack, "PLCA node ID is not set");
> + ret = -EINVAL;
> + goto out_drv;
> + }
> +
> +apply_cfg:
> + ret = phydev->drv->set_plca_cfg(phydev, plca_cfg);
Goto which don't jump to the end of the function is generally frowned
upon. I suggest you put these sanity checks into a little helper, so
you can avoid the goto.
With that change make, feel free to add my reviewed-by.
Andrew
Powered by blists - more mailing lists