diff --git a/drivers/char/mem.c b/drivers/char/mem.c index a074fceb67d..ad82ec92ebd 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include @@ -892,29 +891,23 @@ static int memory_open(struct inode *inode, struct file *filp) { int minor; const struct memdev *dev; - int ret = -ENXIO; - - lock_kernel(); minor = iminor(inode); if (minor >= ARRAY_SIZE(devlist)) - goto out; + return -ENXIO; dev = &devlist[minor]; if (!dev->fops) - goto out; + return -ENXIO; filp->f_op = dev->fops; if (dev->dev_info) filp->f_mapping->backing_dev_info = dev->dev_info; if (dev->fops->open) - ret = dev->fops->open(inode, filp); - else - ret = 0; -out: - unlock_kernel(); - return ret; + return dev->fops->open(inode, filp); + + return 0; } static const struct file_operations memory_fops = {