diff options
author | Andrew Lunn <andrew@lunn.ch> | 2014-10-19 10:41:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-19 12:46:31 -0400 |
commit | 228b16cb13dfa2f77354a9b144a07e86e2dda01c (patch) | |
tree | 0ade083774b11e5e3874a8b1c57d48d93792993a /net | |
parent | a6d4518da371b0d21512ef0f641928d6f99ee70f (diff) |
Net: DSA: Fix checking for get_phy_flags function
The check for the presence or not of the optional switch function
get_phy_flags() called the function, rather than checked to see if it
is a NULL pointer. This causes a derefernce of a NULL pointer on all
switch chips except the sf2, the only switch to implement this call.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Fixes: 6819563e646a ("net: dsa: allow switch drivers to specify phy_device::dev_flags")
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-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 a851e9f14118..6d1817449c36 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c | |||
@@ -599,7 +599,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent, | |||
599 | netif_carrier_off(slave_dev); | 599 | netif_carrier_off(slave_dev); |
600 | 600 | ||
601 | if (p->phy != NULL) { | 601 | if (p->phy != NULL) { |
602 | if (ds->drv->get_phy_flags(ds, port)) | 602 | if (ds->drv->get_phy_flags) |
603 | p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port); | 603 | p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port); |
604 | 604 | ||
605 | phy_attach(slave_dev, dev_name(&p->phy->dev), | 605 | phy_attach(slave_dev, dev_name(&p->phy->dev), |