提交 a518ab93 编写于 作者: C Christoph Hellwig 提交者: Al Viro

[PATCH] tidy up chrdev_open

Use a single goto label for chrdev_put + return error cases.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 ca30bc99
...@@ -386,15 +386,22 @@ static int chrdev_open(struct inode *inode, struct file *filp) ...@@ -386,15 +386,22 @@ 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)
cdev_put(p); goto out_cdev_put;
}
return 0;
out_cdev_put:
cdev_put(p);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册