]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
Add a comment in chrdev_open()
authorJonathan Corbet <corbet@lwn.net>
Sun, 18 May 2008 21:39:11 +0000 (15:39 -0600)
committerJonathan Corbet <corbet@lwn.net>
Fri, 20 Jun 2008 20:05:53 +0000 (14:05 -0600)
I stared at this code for a while and almost deleted it before
understanding crept into my slow brain.  Hopefully this makes life easier
for the next person to happen on it.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
fs/char_dev.c

index 68e510b88457e85d8831aa0b48a0479c137d3cb3..a54d69369b2f4d5384f9072e99ee0e015c780e87 100644 (file)
@@ -373,6 +373,8 @@ static int chrdev_open(struct inode *inode, struct file *filp)
                        return -ENXIO;
                new = container_of(kobj, struct cdev, kobj);
                spin_lock(&cdev_lock);
+               /* Check i_cdev again in case somebody beat us to it while
+                  we dropped the lock. */
                p = inode->i_cdev;
                if (!p) {
                        inode->i_cdev = p = new;