Commit a518ab93 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Al Viro

[PATCH] tidy up chrdev_open

Use a single goto label for chrdev_put + return error cases.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent ca30bc99
......@@ -386,14 +386,21 @@ static int chrdev_open(struct inode *inode, struct file *filp)
cdev_put(new);
if (ret)
return ret;
ret = -ENXIO;
filp->f_op = fops_get(p->ops);
if (!filp->f_op) {
cdev_put(p);
return -ENXIO;
}
if (filp->f_op->open)
if (!filp->f_op)
goto out_cdev_put;
if (filp->f_op->open) {
ret = filp->f_op->open(inode,filp);
if (ret)
goto out_cdev_put;
}
return 0;
out_cdev_put:
cdev_put(p);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment