realtek: mdio: add duplicated port detection
Harden the mdio driver probing by checking for duplicate port definitions. Now that the driver has a valid_port mask this is just a simple bit check. This is the same as upstream does. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/22565 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
48a75a179f
commit
0fbf80b4c8
@ -861,6 +861,10 @@ static int rtmdio_map_ports(struct device *dev)
|
||||
return dev_err_probe(dev, -EINVAL, "%pfwP illegal port number\n",
|
||||
of_fwnode_handle(port));
|
||||
|
||||
if (test_bit(addr, ctrl->valid_ports))
|
||||
return dev_err_probe(dev, -EINVAL, "%pfwP duplicated port number\n",
|
||||
of_fwnode_handle(port));
|
||||
|
||||
if (of_property_read_u32(phy, "reg", &ctrl->smi_addr[addr]))
|
||||
return dev_err_probe(dev, -EINVAL, "%pfwP no phy address\n",
|
||||
of_fwnode_handle(phy));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user