Commit d0417849 authored by Ganesh Goudar's avatar Ganesh Goudar Committed by David S. Miller

cxgb4: fix memory leak in init_one()

Free up mbox_log allocated for PF0 to PF3.

Fixes: 7829451c ("cxgb4: Add control net_device for configuring PCIe VF")
Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2f3ca449
......@@ -5169,13 +5169,15 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
&v, &port_vec);
if (err < 0) {
dev_err(adapter->pdev_dev, "Could not fetch port params\n");
goto free_adapter;
goto free_mbox_log;
}
adapter->params.nports = hweight32(port_vec);
pci_set_drvdata(pdev, adapter);
return 0;
free_mbox_log:
kfree(adapter->mbox_log);
free_adapter:
kfree(adapter);
free_pci_region:
......@@ -5275,6 +5277,7 @@ static void remove_one(struct pci_dev *pdev)
unregister_netdev(adapter->port[0]);
iounmap(adapter->regs);
kfree(adapter->vfinfo);
kfree(adapter->mbox_log);
kfree(adapter);
pci_disable_sriov(pdev);
pci_release_regions(pdev);
......@@ -5321,6 +5324,7 @@ static void shutdown_one(struct pci_dev *pdev)
unregister_netdev(adapter->port[0]);
iounmap(adapter->regs);
kfree(adapter->vfinfo);
kfree(adapter->mbox_log);
kfree(adapter);
pci_disable_sriov(pdev);
pci_release_regions(pdev);
......
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