net: ep93xx_eth: fix mismatch of request_mem_region in remove
authorChuhong Yuan <hslester96@gmail.com>
Thu, 14 Nov 2019 15:43:24 +0000 (23:43 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 15 Nov 2019 20:42:09 +0000 (12:42 -0800)
The driver calls release_resource in remove to match request_mem_region
in probe, which is incorrect.
Fix it by using the right one, release_mem_region.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cirrus/ep93xx_eth.c

index f1a0c4dceda0c3bcd22694b6a31e739742a55e68..f37c9a08c4cf533cf8f78f44f87fd298827c289c 100644 (file)
@@ -763,6 +763,7 @@ static int ep93xx_eth_remove(struct platform_device *pdev)
 {
        struct net_device *dev;
        struct ep93xx_priv *ep;
+       struct resource *mem;
 
        dev = platform_get_drvdata(pdev);
        if (dev == NULL)
@@ -778,8 +779,8 @@ static int ep93xx_eth_remove(struct platform_device *pdev)
                iounmap(ep->base_addr);
 
        if (ep->res != NULL) {
-               release_resource(ep->res);
-               kfree(ep->res);
+               mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+               release_mem_region(mem->start, resource_size(mem));
        }
 
        free_netdev(dev);