diff options
Diffstat (limited to 'net/dsa')
-rw-r--r-- | net/dsa/dsa.c | 6 | ||||
-rw-r--r-- | net/dsa/slave.c | 14 |
2 files changed, 13 insertions, 7 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, | |||
80 | int ret; | 80 | int ret; |
81 | char *name; | 81 | char *name; |
82 | int i; | 82 | int i; |
83 | bool valid_name_found = false; | ||
83 | 84 | ||
84 | /* | 85 | /* |
85 | * Probe for switch model. | 86 | * Probe for switch model. |
@@ -131,8 +132,13 @@ dsa_switch_setup(struct dsa_switch_tree *dst, int index, | |||
131 | } else { | 132 | } else { |
132 | ds->phys_port_mask |= 1 << i; | 133 | ds->phys_port_mask |= 1 << i; |
133 | } | 134 | } |
135 | valid_name_found = true; | ||
134 | } | 136 | } |
135 | 137 | ||
138 | if (!valid_name_found && i == DSA_MAX_PORTS) { | ||
139 | ret = -EINVAL; | ||
140 | goto out; | ||
141 | } | ||
136 | 142 | ||
137 | /* | 143 | /* |
138 | * If the CPU connects to this switch, set the switch tree | 144 | * If the CPU connects to this switch, set the switch tree |
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index e32083d5d8f8..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) | |||
41 | ds->slave_mii_bus->name = "dsa slave smi"; | 41 | ds->slave_mii_bus->name = "dsa slave smi"; |
42 | ds->slave_mii_bus->read = dsa_slave_phy_read; | 42 | ds->slave_mii_bus->read = dsa_slave_phy_read; |
43 | ds->slave_mii_bus->write = dsa_slave_phy_write; | 43 | ds->slave_mii_bus->write = dsa_slave_phy_write; |
44 | snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "%s:%.2x", | 44 | snprintf(ds->slave_mii_bus->id, MII_BUS_ID_SIZE, "dsa-%d:%.2x", |
45 | ds->master_mii_bus->id, ds->pd->sw_addr); | 45 | ds->index, ds->pd->sw_addr); |
46 | ds->slave_mii_bus->parent = &ds->master_mii_bus->dev; | 46 | ds->slave_mii_bus->parent = &ds->master_mii_bus->dev; |
47 | } | 47 | } |
48 | 48 | ||
@@ -203,10 +203,10 @@ dsa_slave_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) | |||
203 | static void dsa_slave_get_drvinfo(struct net_device *dev, | 203 | static void dsa_slave_get_drvinfo(struct net_device *dev, |
204 | struct ethtool_drvinfo *drvinfo) | 204 | struct ethtool_drvinfo *drvinfo) |
205 | { | 205 | { |
206 | strncpy(drvinfo->driver, "dsa", 32); | 206 | strlcpy(drvinfo->driver, "dsa", sizeof(drvinfo->driver)); |
207 | strncpy(drvinfo->version, dsa_driver_version, 32); | 207 | strlcpy(drvinfo->version, dsa_driver_version, sizeof(drvinfo->version)); |
208 | strncpy(drvinfo->fw_version, "N/A", 32); | 208 | strlcpy(drvinfo->fw_version, "N/A", sizeof(drvinfo->fw_version)); |
209 | strncpy(drvinfo->bus_info, "platform", 32); | 209 | strlcpy(drvinfo->bus_info, "platform", sizeof(drvinfo->bus_info)); |
210 | } | 210 | } |
211 | 211 | ||
212 | static int dsa_slave_nway_reset(struct net_device *dev) | 212 | static int dsa_slave_nway_reset(struct net_device *dev) |
@@ -391,7 +391,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
391 | 391 | ||
392 | if (p->phy != NULL) { | 392 | if (p->phy != NULL) { |
393 | phy_attach(slave_dev, dev_name(&p->phy->dev), | 393 | phy_attach(slave_dev, dev_name(&p->phy->dev), |
394 | 0, PHY_INTERFACE_MODE_GMII); | 394 | PHY_INTERFACE_MODE_GMII); |
395 | 395 | ||
396 | p->phy->autoneg = AUTONEG_ENABLE; | 396 | p->phy->autoneg = AUTONEG_ENABLE; |
397 | p->phy->speed = 0; | 397 | p->phy->speed = 0; |