]> git.hungrycats.org Git - linux/commitdiff
gianfar: Check if phydev present on ethtool -A
authorClaudiu Manoil <claudiu.manoil@freescale.com>
Wed, 23 Apr 2014 13:38:47 +0000 (16:38 +0300)
committerJiri Slaby <jslaby@suse.cz>
Fri, 3 Mar 2017 10:44:51 +0000 (11:44 +0100)
commit 98a46d46d1bc983125b6ff9a0e831050a7011713 upstream.

This fixes a seg fault on 'ethtool -A' entry if the
interface is down.  Obviously we need to have the
phy device initialized / "connected" (see of_phy_connect())
to be able to advertise pause frame capabilities.

Fixes: 23402bddf9e56eecb27bbd1e5467b3b79b3dbe58
Signed-off-by: Claudiu Manoil <claudiu.manoil@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
drivers/net/ethernet/freescale/gianfar_ethtool.c

index d3d7ede27ef14854f11b2f7c4a9648d34574dbeb..c0f7328adb1381d64a221b7647d8744b5c04ccf7 100644 (file)
@@ -553,6 +553,9 @@ static int gfar_spauseparam(struct net_device *dev,
        struct gfar __iomem *regs = priv->gfargrp[0].regs;
        u32 oldadv, newadv;
 
+       if (!phydev)
+               return -ENODEV;
+
        if (!(phydev->supported & SUPPORTED_Pause) ||
            (!(phydev->supported & SUPPORTED_Asym_Pause) &&
             (epause->rx_pause != epause->tx_pause)))