Skip to content

Commit

Permalink
cnic: Don't take cnic_dev_lock in cnic_alloc_uio_rings()
Browse files Browse the repository at this point in the history
We are allocating memory with GFP_KERNEL under spinlock.  Since this is
the only call manipulating the cnic_udev_list and it is always under
rtnl_lock, cnic_dev_lock can be safely removed.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Chan authored and David S. Miller committed Jun 3, 2014
1 parent 20f30c2 commit 437b8a2
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/net/ethernet/broadcom/cnic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,21 +1039,17 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
struct cnic_local *cp = dev->cnic_priv;
struct cnic_uio_dev *udev;

read_lock(&cnic_dev_lock);
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;
}
}
read_unlock(&cnic_dev_lock);

udev = kzalloc(sizeof(struct cnic_uio_dev), GFP_ATOMIC);
if (!udev)
Expand All @@ -1067,9 +1063,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
if (__cnic_alloc_uio_rings(udev, pages))
goto err_udev;

write_lock(&cnic_dev_lock);
list_add(&udev->list, &cnic_udev_list);
write_unlock(&cnic_dev_lock);

pci_dev_get(udev->pdev);

Expand Down

0 comments on commit 437b8a2

Please sign in to comment.