Re: [PATCH net-next v13 08/11] net: mdio: realtek-rtl9300: Check for C45 support during setup

[email protected]
Newsgroups org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The format string in `dev_err_probe` uses `%d` to print a `u32` variable (`bus`).
--

--- Patch [8]: [PATCH net-next v13 08/11] net: mdio: realtek-rtl9300: Check for C45 support during setup ---
commit e8d34ab1b625442557bbfb76ca4546a7c625a18a
Author: Markus Stockhausen <[email protected]>

net: mdio: realtek-rtl9300: Check for C45 support during setup

This commit adds a consistency check in the mapping helper to abort setup if
the devicetree defines a C45 PHY for a device without C45 read/write
capabilities.

> diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c
> index 88ba73b2ee812..22b1c4e05354c 100644
> --- a/drivers/net/mdio/mdio-realtek-rtl9300.c
> +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c
> @@ -782,8 +782,14 @@ static int otto_emdio_map_ports(struct device *dev)
[ ... ]
> -		if (of_device_is_compatible(phy_dn, "ethernet-phy-ieee802.3-c45"))
> +		if (of_device_is_compatible(phy_dn, "ethernet-phy-ieee802.3-c45")) {
> +			if (!priv->info->read_c45 || !priv->info->write_c45) {
> +				err = dev_err_probe(dev, -EOPNOTSUPP,
> +						    "bus %d does not support C45 access\n", bus);

[Severity: Low]
This isn't a bug, but should this format string use %u instead of %d?

Since bus is a u32 variable, printing it with a signed format specifier is a
type mismatch. The value will likely remain small enough to print correctly
without overflowing, but using %u would be more precise.

> +				goto put_nodes;
> +			}
>  			priv->smi_bus_is_c45[bus] = true;
> +		}
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.