Skip to content

Commit a30427d

Browse files
author
Jonathan Corbet
committed
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 <corbet@lwn.net>
1 parent f2b9857 commit a30427d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎fs/char_dev.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ static int chrdev_open(struct inode *inode, struct file *filp)
373373
return -ENXIO;
374374
new = container_of(kobj, struct cdev, kobj);
375375
spin_lock(&cdev_lock);
376+
/* Check i_cdev again in case somebody beat us to it while
377+
we dropped the lock. */
376378
p = inode->i_cdev;
377379
if (!p) {
378380
inode->i_cdev = p = new;

0 commit comments

Comments
 (0)