summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKaricheri, Muralidharan <m-karicheri2@ti.com>2015-07-29 00:20:12 +0200
committerDavid S. Miller <davem@davemloft.net>2015-07-30 03:37:40 +0200
commit01a030996e1e2c268a4a484e2cbd3722b705414d (patch)
tree701b52a4378fdb88d7ec1bf985180da549c1268d /drivers
parentebpf, x86: fix general protection fault when tail call is invoked (diff)
downloadlinux-01a030996e1e2c268a4a484e2cbd3722b705414d.tar.xz
linux-01a030996e1e2c268a4a484e2cbd3722b705414d.zip
net: netcp: fix cleanup interface list in netcp_remove()
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/ti/netcp_core.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index ec8ed30196f3..a1c6961323dc 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2112,6 +2112,7 @@ probe_quit:
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;
@@ -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);