aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-01-21 15:40:47 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-21 15:40:47 -0500
commit100204147be9a2b87be2b118959b12eeaf8ef5d0 (patch)
tree774573c6a730967410a51e954577424be0977fe6
parentnet: move rx and tx hash functions to net/core/flow_dissector.c (diff)
parentdsa: make dsa_switch_setup check for valid port names (diff)
downloadlinux-dev-100204147be9a2b87be2b118959b12eeaf8ef5d0.tar.xz
linux-dev-100204147be9a2b87be2b118959b12eeaf8ef5d0.zip
Merge branch 'dsa'
Florian Fainelli says: ==================== These two patches are non-critical bugfixes based on net-next which I stumbled upon while working on Device Tree bindings for DSA (will comme as a separate patch later). ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dsa/dsa.c6
-rw-r--r--net/dsa/slave.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 45295ca09571..2bc62ea857c8 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -80,6 +80,7 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
int ret;
char *name;
int i;
+ bool valid_name_found = false;
/*
* Probe for switch model.
@@ -131,8 +132,13 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index,
} else {
ds->phys_port_mask |= 1 << i;
}
+ valid_name_found = true;
}
+ if (!valid_name_found && i == DSA_MAX_PORTS) {
+ ret = -EINVAL;
+ goto out;
+ }
/*
* If the CPU connects to this switch, set the switch tree
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index f4345582a6b9..6ebd8fbd9285 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -41,8 +41,8 @@ void dsa_slave_mii_bus_init(struct dsa_switch *ds)
ds->slave_mii_bus->name = "dsa slave smi";
ds->slave_mii_bus->read = dsa_slave_phy_read;
ds->slave_mii_bus->write = dsa_slave_phy_write;
- snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "%s:%.2x",
- ds->master_mii_bus->id, ds->pd->sw_addr);
+ snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d:%.2x",
+ ds->index, ds->pd->sw_addr);
ds->slave_mii_bus->parent = &ds->master_mii_bus->dev;
}