diff options
author | Cyrille Pitchen <cyrille.pitchen@atmel.com> | 2014-12-15 09:13:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-15 11:50:45 -0500 |
commit | cf250de07cdfb9f1609d62df51a938159c53cecb (patch) | |
tree | 3a60c9413b5d735d674080c16476c2251ebd82be /drivers/net/ethernet/cadence/macb.c | |
parent | e965be7d17b9c82424cbb079506f0f9a4f41656c (diff) |
net/macb: remove useless calls of devm_free_irq()
Inside macb_probe(), when devm_request_irq() fails on queue q, there is no need
to call devm_free_irq() on queues 0..q-1 because the managed device resources
are released later when calling free_netdev().
Also removing devm_free_irq() call from macb_remove() for the same reason.
Signed-off-by: Cyrille Pitchen <cyrille.pitchen@atmel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cadence/macb.c')
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index 84029ed96d6f..3767271c7667 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -2160,7 +2160,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2160 | int err = -ENXIO; | 2160 | int err = -ENXIO; |
2161 | const char *mac; | 2161 | const char *mac; |
2162 | void __iomem *mem; | 2162 | void __iomem *mem; |
2163 | unsigned int hw_q, queue_mask, q, num_queues, q_irq = 0; | 2163 | unsigned int hw_q, queue_mask, q, num_queues; |
2164 | struct clk *pclk, *hclk, *tx_clk; | 2164 | struct clk *pclk, *hclk, *tx_clk; |
2165 | 2165 | ||
2166 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 2166 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -2235,11 +2235,11 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2235 | * register mapping but we don't want to test the queue index then | 2235 | * register mapping but we don't want to test the queue index then |
2236 | * compute the corresponding register offset at run time. | 2236 | * compute the corresponding register offset at run time. |
2237 | */ | 2237 | */ |
2238 | for (hw_q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) { | 2238 | for (hw_q = 0, q = 0; hw_q < MACB_MAX_QUEUES; ++hw_q) { |
2239 | if (!(queue_mask & (1 << hw_q))) | 2239 | if (!(queue_mask & (1 << hw_q))) |
2240 | continue; | 2240 | continue; |
2241 | 2241 | ||
2242 | queue = &bp->queues[q_irq]; | 2242 | queue = &bp->queues[q]; |
2243 | queue->bp = bp; | 2243 | queue->bp = bp; |
2244 | if (hw_q) { | 2244 | if (hw_q) { |
2245 | queue->ISR = GEM_ISR(hw_q - 1); | 2245 | queue->ISR = GEM_ISR(hw_q - 1); |
@@ -2261,18 +2261,18 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2261 | * must remove the optional gaps that could exist in the | 2261 | * must remove the optional gaps that could exist in the |
2262 | * hardware queue mask. | 2262 | * hardware queue mask. |
2263 | */ | 2263 | */ |
2264 | queue->irq = platform_get_irq(pdev, q_irq); | 2264 | queue->irq = platform_get_irq(pdev, q); |
2265 | err = devm_request_irq(&pdev->dev, queue->irq, macb_interrupt, | 2265 | err = devm_request_irq(&pdev->dev, queue->irq, macb_interrupt, |
2266 | 0, dev->name, queue); | 2266 | 0, dev->name, queue); |
2267 | if (err) { | 2267 | if (err) { |
2268 | dev_err(&pdev->dev, | 2268 | dev_err(&pdev->dev, |
2269 | "Unable to request IRQ %d (error %d)\n", | 2269 | "Unable to request IRQ %d (error %d)\n", |
2270 | queue->irq, err); | 2270 | queue->irq, err); |
2271 | goto err_out_free_irq; | 2271 | goto err_out_free_netdev; |
2272 | } | 2272 | } |
2273 | 2273 | ||
2274 | INIT_WORK(&queue->tx_error_task, macb_tx_error_task); | 2274 | INIT_WORK(&queue->tx_error_task, macb_tx_error_task); |
2275 | q_irq++; | 2275 | q++; |
2276 | } | 2276 | } |
2277 | dev->irq = bp->queues[0].irq; | 2277 | dev->irq = bp->queues[0].irq; |
2278 | 2278 | ||
@@ -2350,7 +2350,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2350 | err = register_netdev(dev); | 2350 | err = register_netdev(dev); |
2351 | if (err) { | 2351 | if (err) { |
2352 | dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); | 2352 | dev_err(&pdev->dev, "Cannot register net device, aborting.\n"); |
2353 | goto err_out_free_irq; | 2353 | goto err_out_free_netdev; |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | err = macb_mii_init(bp); | 2356 | err = macb_mii_init(bp); |
@@ -2373,9 +2373,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
2373 | 2373 | ||
2374 | err_out_unregister_netdev: | 2374 | err_out_unregister_netdev: |
2375 | unregister_netdev(dev); | 2375 | unregister_netdev(dev); |
2376 | err_out_free_irq: | 2376 | err_out_free_netdev: |
2377 | for (q = 0, queue = bp->queues; q < q_irq; ++q, ++queue) | ||
2378 | devm_free_irq(&pdev->dev, queue->irq, queue); | ||
2379 | free_netdev(dev); | 2377 | free_netdev(dev); |
2380 | err_out_disable_clocks: | 2378 | err_out_disable_clocks: |
2381 | if (!IS_ERR(tx_clk)) | 2379 | if (!IS_ERR(tx_clk)) |
@@ -2392,8 +2390,6 @@ static int __exit macb_remove(struct platform_device *pdev) | |||
2392 | { | 2390 | { |
2393 | struct net_device *dev; | 2391 | struct net_device *dev; |
2394 | struct macb *bp; | 2392 | struct macb *bp; |
2395 | struct macb_queue *queue; | ||
2396 | unsigned int q; | ||
2397 | 2393 | ||
2398 | dev = platform_get_drvdata(pdev); | 2394 | dev = platform_get_drvdata(pdev); |
2399 | 2395 | ||
@@ -2405,9 +2401,6 @@ static int __exit macb_remove(struct platform_device *pdev) | |||
2405 | kfree(bp->mii_bus->irq); | 2401 | kfree(bp->mii_bus->irq); |
2406 | mdiobus_free(bp->mii_bus); | 2402 | mdiobus_free(bp->mii_bus); |
2407 | unregister_netdev(dev); | 2403 | unregister_netdev(dev); |
2408 | queue = bp->queues; | ||
2409 | for (q = 0; q < bp->num_queues; ++q, ++queue) | ||
2410 | devm_free_irq(&pdev->dev, queue->irq, queue); | ||
2411 | if (!IS_ERR(bp->tx_clk)) | 2404 | if (!IS_ERR(bp->tx_clk)) |
2412 | clk_disable_unprepare(bp->tx_clk); | 2405 | clk_disable_unprepare(bp->tx_clk); |
2413 | clk_disable_unprepare(bp->hclk); | 2406 | clk_disable_unprepare(bp->hclk); |