projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ca30bc9
)
[PATCH] tidy up chrdev_open
author
Christoph Hellwig
<
[email protected]
>
Mon, 11 Aug 2008 13:34:22 +0000
(15:34 +0200)
committer
Al Viro
<
[email protected]
>
Thu, 23 Oct 2008 09:12:59 +0000
(
05:12
-0400)
Use a single goto label for chrdev_put + return error cases.
Signed-off-by: Christoph Hellwig <
[email protected]
>
Signed-off-by: Al Viro <
[email protected]
>
fs/char_dev.c
patch
|
blob
|
history
diff --git
a/fs/char_dev.c
b/fs/char_dev.c
index 262fa10e213d571c4d14e1c6b08a3c5861e55e03..700697a726187863a3d4557b27410192ad7d45d9 100644
(file)
--- a/
fs/char_dev.c
+++ b/
fs/char_dev.c
@@
-386,15
+386,22
@@
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)
- cdev_put(p);
+ if (ret)
+ goto out_cdev_put;
+ }
+
+ return 0;
+
+ out_cdev_put:
+ cdev_put(p);
return ret;
}