diff options
| author | Julia Lawall <julia@diku.dk> | 2011-06-01 03:10:10 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2011-06-02 00:20:14 -0400 |
| commit | b722dbf176b67c75fe0f5a6b1b31f5ea8aa6117d (patch) | |
| tree | 8eb77b610efcabd6185b964b817b2b30bdebad0d | |
| parent | a3bcc23e890a6d49d6763d9eb073d711de2e0469 (diff) | |
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>
| -rw-r--r-- | drivers/net/davinci_emac.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 29a4f06fbfcf..dcc4a170b0f3 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
| @@ -1781,8 +1781,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
| 1781 | ndev = alloc_etherdev(sizeof(struct emac_priv)); | 1781 | ndev = alloc_etherdev(sizeof(struct emac_priv)); |
| 1782 | if (!ndev) { | 1782 | if (!ndev) { |
| 1783 | dev_err(&pdev->dev, "error allocating net_device\n"); | 1783 | dev_err(&pdev->dev, "error allocating net_device\n"); |
| 1784 | clk_put(emac_clk); | 1784 | rc = -ENOMEM; |
| 1785 | return -ENOMEM; | 1785 | goto free_clk; |
| 1786 | } | 1786 | } |
| 1787 | 1787 | ||
| 1788 | platform_set_drvdata(pdev, ndev); | 1788 | platform_set_drvdata(pdev, ndev); |
| @@ -1796,7 +1796,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) | |||
| 1796 | pdata = pdev->dev.platform_data; | 1796 | pdata = pdev->dev.platform_data; |
| 1797 | if (!pdata) { | 1797 | if (!pdata) { |
| 1798 | dev_err(&pdev->dev, "no platform data\n"); | 1798 | dev_err(&pdev->dev, "no platform data\n"); |
| 1799 | return -ENODEV; | 1799 | rc = -ENODEV; |
| 1800 | goto probe_quit; | ||
| 1800 | } | 1801 | } |
| 1801 | 1802 | ||
| 1802 | /* MAC addr and PHY mask , RMII enable info from platform_data */ | 1803 | /* MAC addr and PHY mask , RMII enable info from platform_data */ |
| @@ -1929,8 +1930,9 @@ no_dma: | |||
| 1929 | iounmap(priv->remap_addr); | 1930 | iounmap(priv->remap_addr); |
| 1930 | 1931 | ||
| 1931 | probe_quit: | 1932 | probe_quit: |
| 1932 | clk_put(emac_clk); | ||
| 1933 | free_netdev(ndev); | 1933 | free_netdev(ndev); |
| 1934 | free_clk: | ||
| 1935 | clk_put(emac_clk); | ||
| 1934 | return rc; | 1936 | return rc; |
| 1935 | } | 1937 | } |
| 1936 | 1938 | ||
