diff options
author | Andrew Lunn <andrew@lunn.ch> | 2016-06-04 15:16:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-06-04 17:29:52 -0400 |
commit | 0e5760440842eee57ff573251e95289e2ee7b15f (patch) | |
tree | b8599569a9211732b0d9abe3648829946d0618b2 /net/dsa/slave.c | |
parent | 76f21b99004ef1f16be6184678f660eab911b8b8 (diff) |
net: dsa: slave: chip data is optional, don't dereference NULL
The new binding does not make use of dsa_chip_data, a.k.a cd. When
retrieving the size of the EEPROM attached to a switch, don't assume
there is a cd attached to the switch structure.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/slave.c')
-rw-r--r-- | net/dsa/slave.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 152436cdab30..135a91706755 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -615,7 +615,7 @@ static int dsa_slave_get_eeprom_len(struct net_device *dev) | |||
615 | struct dsa_slave_priv *p = netdev_priv(dev); | 615 | struct dsa_slave_priv *p = netdev_priv(dev); |
616 | struct dsa_switch *ds = p->parent; | 616 | struct dsa_switch *ds = p->parent; |
617 | 617 | ||
618 | if (ds->cd->eeprom_len) | 618 | if (ds->cd && ds->cd->eeprom_len) |
619 | return ds->cd->eeprom_len; | 619 | return ds->cd->eeprom_len; |
620 | 620 | ||
621 | if (ds->drv->get_eeprom_len) | 621 | if (ds->drv->get_eeprom_len) |