Skip to content

Commit

Permalink
Net: DSA: Fix checking for get_phy_flags function
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 6819563 ("net: dsa: allow switch drivers to specify phy_device::dev_flags")
Cc: Florian Fainelli <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
lunn authored and davem330 committed Oct 19, 2014
1 parent a6d4518 commit 228b16c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ dsa_slave_create(struct dsa_switch *ds, struct device *parent,
netif_carrier_off(slave_dev);

if (p->phy != NULL) {
if (ds->drv->get_phy_flags(ds, port))
if (ds->drv->get_phy_flags)
p->phy->dev_flags |= ds->drv->get_phy_flags(ds, port);

phy_attach(slave_dev, dev_name(&p->phy->dev),
Expand Down

0 comments on commit 228b16c

Please sign in to comment.