diff options
author | Michael Chan <mchan@broadcom.com> | 2012-09-08 06:01:02 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-09-10 15:48:20 -0400 |
commit | f81b0ac475f617c93aeb372140b20cae267294c3 (patch) | |
tree | 169fd1ac31ce6f9362a993be2e95376d2b8d5b4c /drivers/net/ethernet/broadcom/cnic.c | |
parent | 74dd0c42093e0fd70ca7d901d18c2c01a6fd0fd3 (diff) | |
download | op-kernel-dev-f81b0ac475f617c93aeb372140b20cae267294c3.zip op-kernel-dev-f81b0ac475f617c93aeb372140b20cae267294c3.tar.gz |
cnic: Free UIO rings when the device is closed.
This will free up unneeded memory.
Reviewed-by: Eddie Wai <eddie.wai@broadcom.com>
Reviewed-by: Bhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom/cnic.c')
-rw-r--r-- | drivers/net/ethernet/broadcom/cnic.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c index ff35894..38be4d9 100644 --- a/drivers/net/ethernet/broadcom/cnic.c +++ b/drivers/net/ethernet/broadcom/cnic.c @@ -868,6 +868,8 @@ static void cnic_free_resc(struct cnic_dev *dev) if (udev) { udev->dev = NULL; cp->udev = NULL; + if (udev->uio_dev == -1) + __cnic_free_uio_rings(udev); } cnic_free_context(dev); @@ -1039,6 +1041,11 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) list_for_each_entry(udev, &cnic_udev_list, list) { if (udev->pdev == dev->pcidev) { udev->dev = dev; + if (__cnic_alloc_uio_rings(udev, pages)) { + udev->dev = NULL; + read_unlock(&cnic_dev_lock); + return -ENOMEM; + } cp->udev = udev; read_unlock(&cnic_dev_lock); return 0; |