From: Simon Horman <horms@kernel.org>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Lorenzo Bianconi <lorenzo@kernel.org>,
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>,
Russell King <linux@armlinux.org.uk>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [net-next PATCH 2/2] net: airoha: add phylink support for GDM1
Date: Wed, 22 Oct 2025 16:45:43 +0100 [thread overview]
Message-ID: <aPj8J5ntvDGLPYaY@horms.kernel.org> (raw)
In-Reply-To: <20251021193315.2192359-3-ansuelsmth@gmail.com>
On Tue, Oct 21, 2025 at 09:33:12PM +0200, Christian Marangi wrote:
...
> +static int airoha_setup_phylink(struct net_device *netdev)
> +{
> + struct airoha_gdm_port *port = netdev_priv(netdev);
> + struct device *dev = &netdev->dev;
> + phy_interface_t phy_mode;
Hi Christian,
phy_interface_t is an enum and thus may in practice be unsigned...
> + struct phylink *phylink;
> +
> + phy_mode = device_get_phy_mode(dev);
> + if (phy_mode < 0) {
... if so, this condition will always be false.
I suspect the correct approach here is to change the type of phy_mode to int.
Flagged by Smatch.
> + dev_err(dev, "incorrect phy-mode\n");
> + return phy_mode;
> + }
> +
> + port->phylink_config.dev = dev;
> + port->phylink_config.type = PHYLINK_NETDEV;
> + port->phylink_config.mac_capabilities = MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
> + MAC_10000FD;
> +
> + __set_bit(PHY_INTERFACE_MODE_INTERNAL,
> + port->phylink_config.supported_interfaces);
> +
> + phylink = phylink_create(&port->phylink_config, dev_fwnode(dev),
> + phy_mode, &airoha_phylink_ops);
> + if (IS_ERR(phylink))
> + return PTR_ERR(phylink);
> +
> + port->phylink = phylink;
> +
> + return 0;
> +}
> +
> static int airoha_alloc_gdm_port(struct airoha_eth *eth,
> struct device_node *np, int index)
> {
...
--
pw-bot: cr
next prev parent reply other threads:[~2025-10-22 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 19:33 [net-next PATCH 0/2] net: airoha: initial phylink support Christian Marangi
2025-10-21 19:33 ` [net-next PATCH 1/2] net: airoha: use device_set_node helper to setup GDM node Christian Marangi
2025-10-21 19:33 ` [net-next PATCH 2/2] net: airoha: add phylink support for GDM1 Christian Marangi
2025-10-22 7:28 ` Lorenzo Bianconi
2025-10-22 7:42 ` Maxime Chevallier
2025-10-22 15:52 ` Christian Marangi
2025-10-22 15:45 ` Simon Horman [this message]
2025-10-22 15:48 ` Christian Marangi
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=aPj8J5ntvDGLPYaY@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=ansuelsmth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).