Commit 1aaa87af authored by Wei Yongjun's avatar Wei Yongjun Committed by David S. Miller

net: netcp: drop kfree for memory allocated with devm_kzalloc

It's not necessary to free memory allocated with devm_kzalloc in the
remove path and using kfree leads to a double free.

Fixes: 84640e27 ("net: netcp: Add Keystone NetCP core ethernet
driver")
Signed-off-by: default avatarWei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 701470ba
...@@ -2058,7 +2058,6 @@ static void netcp_delete_interface(struct netcp_device *netcp_device, ...@@ -2058,7 +2058,6 @@ static void netcp_delete_interface(struct netcp_device *netcp_device,
if (module->release) if (module->release)
module->release(intf_modpriv->module_priv); module->release(intf_modpriv->module_priv);
list_del(&intf_modpriv->intf_list); list_del(&intf_modpriv->intf_list);
kfree(intf_modpriv);
} }
WARN(!list_empty(&netcp->module_head), "%s interface module list is not empty!\n", WARN(!list_empty(&netcp->module_head), "%s interface module list is not empty!\n",
ndev->name); ndev->name);
...@@ -2153,7 +2152,6 @@ static int netcp_remove(struct platform_device *pdev) ...@@ -2153,7 +2152,6 @@ static int netcp_remove(struct platform_device *pdev)
dev_dbg(&pdev->dev, "Removing module \"%s\"\n", module->name); dev_dbg(&pdev->dev, "Removing module \"%s\"\n", module->name);
module->remove(netcp_device, inst_modpriv->module_priv); module->remove(netcp_device, inst_modpriv->module_priv);
list_del(&inst_modpriv->inst_list); list_del(&inst_modpriv->inst_list);
kfree(inst_modpriv);
} }
/* now that all modules are removed, clean up the interfaces */ /* now that all modules are removed, clean up the interfaces */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment