Unlike with regular user ports, the CPU port doesn't have a dev or index member assigned, which leads to subtle breakage porting Linux drivers. Use the new dsa_port_alloc() helper to fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/net/dsa.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/dsa.c b/drivers/net/dsa.c index ea1a6a699698..c1430a93615b 100644 --- a/drivers/net/dsa.c +++ b/drivers/net/dsa.c @@ -317,7 +317,6 @@ static int dsa_switch_register_master(struct dsa_switch *ds, { struct device_node *phy_node; struct phy_device *phydev; - struct dsa_port *dp; int ret; if (ds->edev_master) { @@ -348,9 +347,7 @@ static int dsa_switch_register_master(struct dsa_switch *ds, phydev->interface = of_get_phy_mode(np); - ds->dp[port] = xzalloc(sizeof(*dp)); - dp = ds->dp[port]; - dp->ds = ds; + dsa_port_alloc(ds, np, port); ds->cpu_port = port; ds->cpu_port_fixed_phy = phydev; -- 2.30.2