Skip to content

Commit

Permalink
net: netcp: fix cleanup interface list in netcp_remove()
Browse files Browse the repository at this point in the history
Currently if user do rmmod keystone_netcp.ko following warning is
seen :-

[   59.035891] ------------[ cut here ]------------
[   59.040535] WARNING: CPU: 2 PID: 1619 at drivers/net/ethernet/ti/
netcp_core.c:2127 netcp_remove)

This is because the interface list is not cleaned up in netcp_remove.
This patch fixes this. Also fix some checkpatch related warnings.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Karicheri, Muralidharan authored and David S. Miller committed Jul 30, 2015
1 parent 2482abb commit 01a0309
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions drivers/net/ethernet/ti/netcp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2112,6 +2112,7 @@ static int netcp_probe(struct platform_device *pdev)
static int netcp_remove(struct platform_device *pdev)
{
struct netcp_device *netcp_device = platform_get_drvdata(pdev);
struct netcp_intf *netcp_intf, *netcp_tmp;
struct netcp_inst_modpriv *inst_modpriv, *tmp;
struct netcp_module *module;

Expand All @@ -2123,8 +2124,16 @@ static int netcp_remove(struct platform_device *pdev)
list_del(&inst_modpriv->inst_list);
kfree(inst_modpriv);
}
WARN(!list_empty(&netcp_device->interface_head), "%s interface list not empty!\n",
pdev->name);

/* now that all modules are removed, clean up the interfaces */
list_for_each_entry_safe(netcp_intf, netcp_tmp,
&netcp_device->interface_head,
interface_list) {
netcp_delete_interface(netcp_device, netcp_intf->ndev);
}

WARN(!list_empty(&netcp_device->interface_head),
"%s interface list not empty!\n", pdev->name);

devm_kfree(&pdev->dev, netcp_device);
pm_runtime_put_sync(&pdev->dev);
Expand Down

0 comments on commit 01a0309

Please sign in to comment.