Subject: AW: [PATCH net-next 3/8] net: mdio: realtek-rtl9300: harden otto_emdio_map_ports()

From: "Markus Stockhausen" <[email-masked]>
Date: Tue, 2 Jun 2026 12:42:47 +0200

> Von: Jagielski, Jedrzej <[email-masked]> 
> Gesendet: Dienstag, 2. Juni 2026 11:38
> Betreff: RE: [PATCH net-next 3/8] net: mdio: realtek-rtl9300: harden
otto_emdio_map_ports()
> ...
> >+		if (addr >= PHY_MAX_ADDR)
> >+			return dev_err_probe(dev, -EINVAL, "illegal smi
address %d\n", 
> >+addr);
>
> Could we have more meaningful error code than EINVAL; EFAULT perhaps if
that's bad addr case?
> what do you think?

EFAULT seems to be the most unusal error code here.
But looking at other implementations there is no clear
guidance.

- phy package uses -EINVAL [1]
- ax88172a uses -ENODEV [2]
- altera uses -ENODEV [3]

> Also - is %d convenient for printing address value?

Will take that as it matches the other MDIO outputs. 

Markus

[1]
https://elixir.bootlin.com/linux/v6.18.1/source/drivers/net/phy/phy_package.
c#L215 
[2]
https://elixir.bootlin.com/linux/v6.18.1/source/drivers/net/usb/ax88172a.c#L
213
[3]
https://elixir.bootlin.com/linux/v6.18.1/source/drivers/net/ethernet/altera/
altera_tse_main.c#L625