From: Jonathan Corbet Date: Sun, 18 May 2008 21:39:11 +0000 (-0600) Subject: Add a comment in chrdev_open() X-Git-Tag: v2.6.27-rc1~1103^2~86 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a30427d92d0bc152b833088e4a305bbeb1a0c162;p=linux-2.6-omap-h63xx.git Add a comment in chrdev_open() 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 --- diff --git a/fs/char_dev.c b/fs/char_dev.c index 68e510b8845..a54d69369b2 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -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;