]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Sleeping function called from illegal context...
authorDavid Brownell <david-b@pacbell.net>
Sun, 29 Sep 2002 15:08:07 +0000 (08:08 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Sun, 29 Sep 2002 15:08:07 +0000 (08:08 -0700)
Fix pci_pool_create() from calling device_create_file() under
pools_lock.

Found by the new "may_sleep" infrastructure.

drivers/pci/pool.c

index da6ac3dc20f7ca4c028d7c9f117d44cd11b5554d..642e22366653534453d0511cb0664d80d4011ebf 100644 (file)
@@ -139,12 +139,14 @@ pci_pool_create (const char *name, struct pci_dev *pdev,
        retval->dev = pdev;
 
        if (pdev) {
+               int     do_add;
                spin_lock_irqsave (&pools_lock, flags);
+               do_add = list_empty (&pdev->pools);
                /* note:  not currently insisting "name" be unique */
-               if (list_empty (&pdev->pools))
-                       device_create_file (&pdev->dev, &dev_attr_pools);
                list_add (&retval->pools, &pdev->pools);
                spin_unlock_irqrestore (&pools_lock, flags);
+               if (do_add)
+                       device_create_file (&pdev->dev, &dev_attr_pools);
        } else
                INIT_LIST_HEAD (&retval->pools);