]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/char/nvram.c
Merge branch 'sched/for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip...
[linux-2.6-omap-h63xx.git] / drivers / char / nvram.c
index 98dec380af495607a0ce360720134234671347e4..39f6357e3b5d0a63e432cf0238cc84aba4b8d33f 100644 (file)
@@ -333,12 +333,14 @@ nvram_ioctl(struct inode *inode, struct file *file,
 static int
 nvram_open(struct inode *inode, struct file *file)
 {
+       lock_kernel();
        spin_lock(&nvram_state_lock);
 
        if ((nvram_open_cnt && (file->f_flags & O_EXCL)) ||
            (nvram_open_mode & NVRAM_EXCL) ||
            ((file->f_mode & 2) && (nvram_open_mode & NVRAM_WRITE))) {
                spin_unlock(&nvram_state_lock);
+               unlock_kernel();
                return -EBUSY;
        }
 
@@ -349,6 +351,7 @@ nvram_open(struct inode *inode, struct file *file)
        nvram_open_cnt++;
 
        spin_unlock(&nvram_state_lock);
+       unlock_kernel();
 
        return 0;
 }
@@ -440,7 +443,7 @@ nvram_init(void)
 
        /* First test whether the driver should init at all */
        if (!CHECK_DRIVER_INIT())
-               return -ENXIO;
+               return -ENODEV;
 
        ret = misc_register(&nvram_dev);
        if (ret) {