diff options
Diffstat (limited to 'drivers/char/mem.c')
-rw-r--r-- | drivers/char/mem.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 42e65cf8ab52..30eff80fed6f 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/bootmem.h> | 26 | #include <linux/bootmem.h> |
27 | #include <linux/splice.h> | 27 | #include <linux/splice.h> |
28 | #include <linux/pfn.h> | 28 | #include <linux/pfn.h> |
29 | #include <linux/smp_lock.h> | ||
30 | 29 | ||
31 | #include <asm/uaccess.h> | 30 | #include <asm/uaccess.h> |
32 | #include <asm/io.h> | 31 | #include <asm/io.h> |
@@ -892,29 +891,23 @@ static int memory_open(struct inode *inode, struct file *filp) | |||
892 | { | 891 | { |
893 | int minor; | 892 | int minor; |
894 | const struct memdev *dev; | 893 | const struct memdev *dev; |
895 | int ret = -ENXIO; | ||
896 | |||
897 | lock_kernel(); | ||
898 | 894 | ||
899 | minor = iminor(inode); | 895 | minor = iminor(inode); |
900 | if (minor >= ARRAY_SIZE(devlist)) | 896 | if (minor >= ARRAY_SIZE(devlist)) |
901 | goto out; | 897 | return -ENXIO; |
902 | 898 | ||
903 | dev = &devlist[minor]; | 899 | dev = &devlist[minor]; |
904 | if (!dev->fops) | 900 | if (!dev->fops) |
905 | goto out; | 901 | return -ENXIO; |
906 | 902 | ||
907 | filp->f_op = dev->fops; | 903 | filp->f_op = dev->fops; |
908 | if (dev->dev_info) | 904 | if (dev->dev_info) |
909 | filp->f_mapping->backing_dev_info = dev->dev_info; | 905 | filp->f_mapping->backing_dev_info = dev->dev_info; |
910 | 906 | ||
911 | if (dev->fops->open) | 907 | if (dev->fops->open) |
912 | ret = dev->fops->open(inode, filp); | 908 | return dev->fops->open(inode, filp); |
913 | else | 909 | |
914 | ret = 0; | 910 | return 0; |
915 | out: | ||
916 | unlock_kernel(); | ||
917 | return ret; | ||
918 | } | 911 | } |
919 | 912 | ||
920 | static const struct file_operations memory_fops = { | 913 | static const struct file_operations memory_fops = { |