From: Vladimir Oltean <olteanv@gmail.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: netdev@vger.kernel.org,
Horatiu Vultur <horatiu.vultur@microchip.com>,
"maintainer:MICROCHIP LAN966X ETHERNET DRIVER"
<UNGLinuxDriver@microchip.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] net: lan966x: enforce phy-mode presence
Date: Fri, 5 Sep 2025 15:52:20 +0300 [thread overview]
Message-ID: <20250905125220.mhy7ln4ufhg4onwo@skbuf> (raw)
In-Reply-To: <20250904203834.3660-1-rosenp@gmail.com>
On Thu, Sep 04, 2025 at 01:38:34PM -0700, Rosen Penev wrote:
> The documentation for lan966x states that phy-mode is a required
> property but the code does not enforce this. Add an error check.
>
> Fixes: db8bcaad5393 ("net: lan966x: add the basic lan966x driver")
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> index 7001584f1b7a..5d28710f4fd2 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> @@ -1199,6 +1199,9 @@ static int lan966x_probe(struct platform_device *pdev)
> continue;
>
> phy_mode = fwnode_get_phy_mode(portnp);
> + if (phy_mode)
> + goto cleanup_ports;
It's not really great to submit bug fixes without testing them.
/**
* fwnode_get_phy_mode - Get phy mode for given firmware node
* @fwnode: Pointer to the given node
*
* The function gets phy interface string from property 'phy-mode' or
* 'phy-connection-type', and return its index in phy_modes table, or errno in
* error case.
*/
The test you add will only pass for phy-mode = "", where phy_mode will
be PHY_INTERFACE_MODE_NA. Otherwise, it will be a negative error code,
or a positive phy_interface_t value, and both will result in a "goto
cleanup_ports".
What is the impact of the problem? What happens without your fix?
> +
> err = lan966x_probe_port(lan966x, p, phy_mode, portnp);
> if (err)
> goto cleanup_ports;
> --
> 2.51.0
>
>
next prev parent reply other threads:[~2025-09-05 12:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-04 20:38 [PATCH net] net: lan966x: enforce phy-mode presence Rosen Penev
2025-09-04 21:02 ` Andrew Lunn
2025-09-04 21:27 ` Rosen Penev
2025-09-08 12:16 ` Andrew Lunn
2025-09-05 11:59 ` Simon Horman
2025-09-05 12:52 ` Vladimir Oltean [this message]
2025-09-05 20:05 ` Rosen Penev
2025-09-09 7:46 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250905125220.mhy7ln4ufhg4onwo@skbuf \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horatiu.vultur@microchip.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rosenp@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox