Skip to content

Commit b722dbf

Browse files
Julia Lawalldavem330
authored andcommitted
drivers/net/davinci_emac.c: add missing clk_put
Go to existing error handling code at the end of the function that calls clk_put. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r exists@ expression e1,e2; statement S; @@ e1 = clk_get@p1(...); ... when != e1 = e2 when != clk_put(e1) when any if (...) { ... when != clk_put(e1) when != if (...) { ... clk_put(e1) ... } * return@p3 ...; } else S // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Kevin Hilman <khilman@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a3bcc23 commit b722dbf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/net/davinci_emac.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1781,8 +1781,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
17811781
ndev = alloc_etherdev(sizeof(struct emac_priv));
17821782
if (!ndev) {
17831783
dev_err(&pdev->dev, "error allocating net_device\n");
1784-
clk_put(emac_clk);
1785-
return -ENOMEM;
1784+
rc = -ENOMEM;
1785+
goto free_clk;
17861786
}
17871787

17881788
platform_set_drvdata(pdev, ndev);
@@ -1796,7 +1796,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
17961796
pdata = pdev->dev.platform_data;
17971797
if (!pdata) {
17981798
dev_err(&pdev->dev, "no platform data\n");
1799-
return -ENODEV;
1799+
rc = -ENODEV;
1800+
goto probe_quit;
18001801
}
18011802

18021803
/* MAC addr and PHY mask , RMII enable info from platform_data */
@@ -1929,8 +1930,9 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
19291930
iounmap(priv->remap_addr);
19301931

19311932
probe_quit:
1932-
clk_put(emac_clk);
19331933
free_netdev(ndev);
1934+
free_clk:
1935+
clk_put(emac_clk);
19341936
return rc;
19351937
}
19361938

0 commit comments

Comments
 (0)