mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
[PATCH] tidy up chrdev_open
Use a single goto label for chrdev_put + return error cases. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
ca30bc9952
commit
a518ab9329
1 changed files with 14 additions and 7 deletions
|
@ -386,14 +386,21 @@ static int chrdev_open(struct inode *inode, struct file *filp)
|
||||||
cdev_put(new);
|
cdev_put(new);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ret = -ENXIO;
|
||||||
filp->f_op = fops_get(p->ops);
|
filp->f_op = fops_get(p->ops);
|
||||||
if (!filp->f_op) {
|
if (!filp->f_op)
|
||||||
cdev_put(p);
|
goto out_cdev_put;
|
||||||
return -ENXIO;
|
|
||||||
}
|
if (filp->f_op->open) {
|
||||||
if (filp->f_op->open)
|
|
||||||
ret = filp->f_op->open(inode,filp);
|
ret = filp->f_op->open(inode,filp);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
goto out_cdev_put;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
out_cdev_put:
|
||||||
cdev_put(p);
|
cdev_put(p);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue