X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fchar_dev.c;h=700697a726187863a3d4557b27410192ad7d45d9;hb=ddb72b02414228844ad46f7cbd42eccea01fb485;hp=3cb7cda3d780e95026142398f4c52cdf565d93b6;hpb=ff877ea80efa2015b6263766f78ee42c2a1b32f9;p=linux-2.6-omap-h63xx.git diff --git a/fs/char_dev.c b/fs/char_dev.c index 3cb7cda3d78..700697a7261 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -22,9 +22,6 @@ #include #include -#ifdef CONFIG_KMOD -#include -#endif #include "internal.h" /* @@ -389,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; }