Thread (21 messages) 21 messages, 4 authors, 2025-07-14

Re: [PATCH net-next v7 04/15] net: phy: Introduce PHY ports representation

From: Simon Horman <horms@kernel.org>
Date: 2025-07-01 13:02:50
Also in: linux-arm-kernel, linux-arm-msm, linux-devicetree, lkml

On Mon, Jun 30, 2025 at 04:33:03PM +0200, Maxime Chevallier wrote:

...
+/**
+ * phy_port_get_type() - get the PORT_* attribut for that port.
+ * @port: The port we want the information from
+ *
+ * Returns: A PORT_XXX value.
+ */
+int phy_port_get_type(struct phy_port *port)
+{
+	if (port->mediums & ETHTOOL_LINK_MEDIUM_BASET)
Hi Maxime,

Should this be:

	if (port->mediums & BIT(ETHTOOL_LINK_MEDIUM_BASET))

Flagged by Smatch (because ETHTOOL_LINK_MEDIUM_BASET is 0,
so as-is the condition is always false).
+		return PORT_TP;
+
+	if (phy_port_is_fiber(port))
+		return PORT_FIBRE;
+
+	return PORT_OTHER;
+}
+EXPORT_SYMBOL_GPL(phy_port_get_type);
...
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help