Even if commit 1d27732f411d ("net: dsa: setup and teardown ports") indicated
that registering a devlink instance for unused ports is not a problem, and this
is true, this can be confusing nonetheless, so let's not do it.
Fixes: 1d27732f411d ("net: dsa: setup and teardown ports")
Reported-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa2.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
Even if commit 1d27732f411d ("net: dsa: setup and teardown ports") indicated
that registering a devlink instance for unused ports is not a problem, and this
is true, this can be confusing nonetheless, so let's not do it.
Fixes: 1d27732f411d ("net: dsa: setup and teardown ports")
Reported-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
net/dsa/dsa2.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
@@ -262,13 +262,14 @@ static int dsa_port_setup(struct dsa_port *dp)memset(&dp->devlink_port,0,sizeof(dp->devlink_port));+if(dp->type==DSA_PORT_TYPE_UNUSED)+return0;+err=devlink_port_register(ds->devlink,&dp->devlink_port,dp->index);if(err)returnerr;switch(dp->type){-caseDSA_PORT_TYPE_UNUSED:-break;caseDSA_PORT_TYPE_CPU:caseDSA_PORT_TYPE_DSA:err=dsa_port_link_register_of(dp);
@@ -293,11 +294,12 @@ static int dsa_port_setup(struct dsa_port *dp)staticvoiddsa_port_teardown(structdsa_port*dp){+if(dp->type==DSA_PORT_TYPE_UNUSED)+return;+devlink_port_unregister(&dp->devlink_port);switch(dp->type){-caseDSA_PORT_TYPE_UNUSED:-break;
Actually those should be kept in there in order not to generate a
warning about DSA_PORT_TYPE_UNUSED not being handled by the switch()
case statement, I will resubmit that shortly, or we could even move the
registration until after, either way is likely fine.
--
Florian