mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 15:54:15 +08:00
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>
This commit is contained in:
parent
76f21b9900
commit
0e57604408
@ -615,7 +615,7 @@ static int dsa_slave_get_eeprom_len(struct net_device *dev)
|
||||
struct dsa_slave_priv *p = netdev_priv(dev);
|
||||
struct dsa_switch *ds = p->parent;
|
||||
|
||||
if (ds->cd->eeprom_len)
|
||||
if (ds->cd && ds->cd->eeprom_len)
|
||||
return ds->cd->eeprom_len;
|
||||
|
||||
if (ds->drv->get_eeprom_len)
|
||||
|
Loading…
Reference in New Issue
Block a user