Skip to content

Commit

Permalink
Add a comment in chrdev_open()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent f2b9857 commit a30427d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/char_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a30427d

Please sign in to comment.