From: Alexander Duyck Date: Mon, 14 Sep 2009 08:23:13 +0000 (+0000) Subject: igb: do not allow phy sw reset code to make calls to null pointers X-Git-Tag: upstream/snapshot3+hdmi~16552^2~362 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d314737ad3bad6b4603b243fd6db572385259690;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git igb: do not allow phy sw reset code to make calls to null pointers In the case of fiber and serdes adapters we were seeing issues with ethtool -t causing kernel panics due to null function pointers. To prevent this we need to exit out of the phy reset code in the event that we do not have a valid phy. Signed-off-by: Alexander Duyck Signed-off-by: Don Skidmore Signed-off-by: David S. Miller --- diff --git a/drivers/net/igb/e1000_phy.c b/drivers/net/igb/e1000_phy.c index c1f4da6..ee46060 100644 --- a/drivers/net/igb/e1000_phy.c +++ b/drivers/net/igb/e1000_phy.c @@ -1565,9 +1565,12 @@ out: **/ s32 igb_phy_sw_reset(struct e1000_hw *hw) { - s32 ret_val; + s32 ret_val = 0; u16 phy_ctrl; + if (!(hw->phy.ops.read_reg)) + goto out; + ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); if (ret_val) goto out;