mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
net: dsa: get tree before parsing ports
We will need a reference to the dsa_switch_tree when parsing a CPU port, so fetch it right after parsing the member and before parsing ports. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
6da2a940ac
commit
0eefe2c173
@ -751,18 +751,10 @@ static int _dsa_register_switch(struct dsa_switch *ds)
|
|||||||
err = dsa_parse_member_dn(np, &tree, &index);
|
err = dsa_parse_member_dn(np, &tree, &index);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = dsa_parse_ports_of(np, ds);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
} else {
|
} else {
|
||||||
err = dsa_parse_member(pdata, &tree, &index);
|
err = dsa_parse_member(pdata, &tree, &index);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = dsa_parse_ports(pdata, ds);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dst = dsa_tree_touch(tree);
|
dst = dsa_tree_touch(tree);
|
||||||
@ -773,6 +765,16 @@ static int _dsa_register_switch(struct dsa_switch *ds)
|
|||||||
ds->index = index;
|
ds->index = index;
|
||||||
ds->cd = pdata;
|
ds->cd = pdata;
|
||||||
|
|
||||||
|
if (np) {
|
||||||
|
err = dsa_parse_ports_of(np, ds);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
} else {
|
||||||
|
err = dsa_parse_ports(pdata, ds);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initialize the routing table */
|
/* Initialize the routing table */
|
||||||
for (i = 0; i < DSA_MAX_SWITCHES; ++i)
|
for (i = 0; i < DSA_MAX_SWITCHES; ++i)
|
||||||
ds->rtable[i] = DSA_RTABLE_NONE;
|
ds->rtable[i] = DSA_RTABLE_NONE;
|
||||||
|
Loading…
Reference in New Issue
Block a user