Skip to content

Commit

Permalink
stmmac: fix check for phydev being open
Browse files Browse the repository at this point in the history
Current check of phydev with IS_ERR(phydev) may make not much sense
because of_phy_connect() returns NULL on failure instead of error value.

Still for checking result of phy_connect() IS_ERR() makes perfect sense.

So let's use combined check IS_ERR_OR_NULL() that covers both cases.

Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Alexey Brodkin authored and David S. Miller committed Sep 10, 2015
1 parent 1f0ca20 commit dfc50fc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -837,8 +837,11 @@ static int stmmac_init_phy(struct net_device *dev)
interface);
}

if (IS_ERR(phydev)) {
if (IS_ERR_OR_NULL(phydev)) {
pr_err("%s: Could not attach to PHY\n", dev->name);
if (!phydev)
return -ENODEV;

return PTR_ERR(phydev);
}

Expand Down

0 comments on commit dfc50fc

Please sign in to comment.