]> git.baikalelectronics.ru Git - kernel.git/commit
net: dsa: Initialize ds->cpu_port_mask earlier
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 24 Jul 2017 17:49:23 +0000 (10:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Jul 2017 00:36:27 +0000 (17:36 -0700)
commit7f02f82ac7ebfb86c74845ad8ae1febc7b799828
tree336084339766119bfac6749d46d49f951e012021
parent2e52770060033e23f9b8ee6ef239a3db9be2a7d9
net: dsa: Initialize ds->cpu_port_mask earlier

The mt7530 driver has its dsa_switch_ops::get_tag_protocol function
check ds->cpu_port_mask to issue a warning in case the configured CPU
port is not capable of supporting tags.

After commit 02029399ed8a ("net: dsa: Initialize all CPU and enabled
ports masks in dsa_ds_parse()") we slightly re-arranged the
initialization such that this was no longer working. Just make sure that
ds->cpu_port_mask is set prior to the first call to get_tag_protocol,
thus restoring the expected contract. In case of error, the CPU port bit
is cleared.

Fixes: 02029399ed8a ("net: dsa: Initialize all CPU and enabled ports masks in dsa_ds_parse()")
Reported-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/dsa2.c