diff options
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r-- | drivers/net/cnic.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c index 92bac19ad60a..6dff32196c92 100644 --- a/drivers/net/cnic.c +++ b/drivers/net/cnic.c | |||
@@ -940,7 +940,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) | |||
940 | &udev->l2_ring_map, | 940 | &udev->l2_ring_map, |
941 | GFP_KERNEL | __GFP_COMP); | 941 | GFP_KERNEL | __GFP_COMP); |
942 | if (!udev->l2_ring) | 942 | if (!udev->l2_ring) |
943 | return -ENOMEM; | 943 | goto err_udev; |
944 | 944 | ||
945 | udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; | 945 | udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; |
946 | udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); | 946 | udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); |
@@ -948,7 +948,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) | |||
948 | &udev->l2_buf_map, | 948 | &udev->l2_buf_map, |
949 | GFP_KERNEL | __GFP_COMP); | 949 | GFP_KERNEL | __GFP_COMP); |
950 | if (!udev->l2_buf) | 950 | if (!udev->l2_buf) |
951 | return -ENOMEM; | 951 | goto err_dma; |
952 | 952 | ||
953 | write_lock(&cnic_dev_lock); | 953 | write_lock(&cnic_dev_lock); |
954 | list_add(&udev->list, &cnic_udev_list); | 954 | list_add(&udev->list, &cnic_udev_list); |
@@ -959,6 +959,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages) | |||
959 | cp->udev = udev; | 959 | cp->udev = udev; |
960 | 960 | ||
961 | return 0; | 961 | return 0; |
962 | err_dma: | ||
963 | dma_free_coherent(&udev->pdev->dev, udev->l2_ring_size, | ||
964 | udev->l2_ring, udev->l2_ring_map); | ||
965 | err_udev: | ||
966 | kfree(udev); | ||
967 | return -ENOMEM; | ||
962 | } | 968 | } |
963 | 969 | ||
964 | static int cnic_init_uio(struct cnic_dev *dev) | 970 | static int cnic_init_uio(struct cnic_dev *dev) |