Skip to content

Commit 0d2f3b8

Browse files
committed
Merge branch 'mdio-mux-cleanup'
Vladimir Oltean says: ==================== MDIO mux cleanup This small patch set resolves some technical debt in the MDIO mux driver which was discovered during the investigation for commit 1f9f214 ("net: mdio-mux: fix C45 access returning -EIO after API change"). The patches have been sitting for 2 months in the NXP SDK kernel and haven't caused issues. ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents b3cb7a8 + 10ad63d commit 0d2f3b8

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

drivers/net/mdio/mdio-mux.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ int mdio_mux_init(struct device *dev,
190190
r = of_property_read_u32(child_bus_node, "reg", &v);
191191
if (r) {
192192
dev_err(dev,
193-
"Error: Failed to find reg for child %pOF\n",
194-
child_bus_node);
193+
"Error: Failed to find reg for child %pOF: %pe\n",
194+
child_bus_node, ERR_PTR(r));
195195
continue;
196196
}
197197

@@ -214,8 +214,10 @@ int mdio_mux_init(struct device *dev,
214214
snprintf(cb->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x.%x",
215215
cb->mii_bus->name, pb->parent_id, v);
216216
cb->mii_bus->parent = dev;
217-
cb->mii_bus->read = mdio_mux_read;
218-
cb->mii_bus->write = mdio_mux_write;
217+
if (parent_bus->read)
218+
cb->mii_bus->read = mdio_mux_read;
219+
if (parent_bus->write)
220+
cb->mii_bus->write = mdio_mux_write;
219221
if (parent_bus->read_c45)
220222
cb->mii_bus->read_c45 = mdio_mux_read_c45;
221223
if (parent_bus->write_c45)
@@ -229,8 +231,8 @@ int mdio_mux_init(struct device *dev,
229231
}
230232
devm_kfree(dev, cb);
231233
dev_err(dev,
232-
"Error: Failed to register MDIO bus for child %pOF\n",
233-
child_bus_node);
234+
"Error: Failed to register MDIO bus for child %pOF: %pe\n",
235+
child_bus_node, ERR_PTR(r));
234236
} else {
235237
cb->next = pb->children;
236238
pb->children = cb;

0 commit comments

Comments
 (0)