提交 f81b0ac4 编写于 作者: M Michael Chan 提交者: David S. Miller

cnic: Free UIO rings when the device is closed.

This will free up unneeded memory.
Reviewed-by: NEddie Wai <eddie.wai@broadcom.com>
Reviewed-by: NBhanu Prakash Gollapudi <bprakash@broadcom.com>
Signed-off-by: NMichael Chan <mchan@broadcom.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 74dd0c42
...@@ -868,6 +868,8 @@ static void cnic_free_resc(struct cnic_dev *dev) ...@@ -868,6 +868,8 @@ static void cnic_free_resc(struct cnic_dev *dev)
if (udev) { if (udev) {
udev->dev = NULL; udev->dev = NULL;
cp->udev = NULL; cp->udev = NULL;
if (udev->uio_dev == -1)
__cnic_free_uio_rings(udev);
} }
cnic_free_context(dev); cnic_free_context(dev);
...@@ -1039,6 +1041,11 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) ...@@ -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) { list_for_each_entry(udev, &cnic_udev_list, list) {
if (udev->pdev == dev->pcidev) { if (udev->pdev == dev->pcidev) {
udev->dev = dev; udev->dev = dev;
if (__cnic_alloc_uio_rings(udev, pages)) {
udev->dev = NULL;
read_unlock(&cnic_dev_lock);
return -ENOMEM;
}
cp->udev = udev; cp->udev = udev;
read_unlock(&cnic_dev_lock); read_unlock(&cnic_dev_lock);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册