Commit cb0a178c authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller

drivers/net/ethernet/ti: Move call to PTR_ERR after reassignment

PTR_ERR should be called before its argument is cleared.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
constant c;
@@

*e = c
... when != e = e1
    when != &e
    when != true IS_ERR(e)
*PTR_ERR(e)
// </smpl>
Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Reported-by: default avatarJosh Triplett <josh@joshtriplett.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4b8a8bc9
......@@ -1600,8 +1600,9 @@ static int emac_dev_open(struct net_device *ndev)
if (IS_ERR(priv->phydev)) {
dev_err(emac_dev, "could not connect to phy %s\n",
priv->phy_id);
ret = PTR_ERR(priv->phydev);
priv->phydev = NULL;
return PTR_ERR(priv->phydev);
return ret;
}
priv->link = 0;
......
......@@ -318,9 +318,9 @@ static int __devinit davinci_mdio_probe(struct platform_device *pdev)
data->clk = clk_get(dev, NULL);
if (IS_ERR(data->clk)) {
data->clk = NULL;
dev_err(dev, "failed to get device clock\n");
ret = PTR_ERR(data->clk);
data->clk = NULL;
goto bail_out;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment