realtek: mdio: harden rtmdio_probe_one()
rtmdio_probe_one() should be only called by rtmdio_probe() after it has validated the dts input. Nevertheless be defensive and add another consistency check. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Link: https://github.com/openwrt/openwrt/pull/23204 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
0606ea2749
commit
7d5219b59b
@ -945,7 +945,9 @@ static int rtmdio_probe_one(struct device *dev, struct rtmdio_ctrl *ctrl,
|
||||
|
||||
ret = fwnode_property_read_u32(node, "reg", &smi_bus);
|
||||
if (ret)
|
||||
return ret;
|
||||
return dev_err_probe(dev, ret, "%pfwP missing reg property for MDIO bus\n", node);
|
||||
if (smi_bus >= ctrl->cfg->num_busses)
|
||||
return dev_err_probe(dev, -EINVAL, "%pfwP wrong bus index %d\n", node, smi_bus);
|
||||
|
||||
bus = devm_mdiobus_alloc_size(dev, sizeof(*chan));
|
||||
if (!bus)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user