aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/sbus/char')
-rw-r--r--drivers/sbus/char/jsflash.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index 4b7079fdc10c..2bec9ccc0293 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -27,6 +27,7 @@
27 */ 27 */
28 28
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/smp_lock.h>
30#include <linux/types.h> 31#include <linux/types.h>
31#include <linux/errno.h> 32#include <linux/errno.h>
32#include <linux/miscdevice.h> 33#include <linux/miscdevice.h>
@@ -417,11 +418,17 @@ static int jsf_mmap(struct file * file, struct vm_area_struct * vma)
417 418
418static int jsf_open(struct inode * inode, struct file * filp) 419static int jsf_open(struct inode * inode, struct file * filp)
419{ 420{
420 421 lock_kernel();
421 if (jsf0.base == 0) return -ENXIO; 422 if (jsf0.base == 0) {
422 if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) 423 unlock_kernel();
424 return -ENXIO;
425 }
426 if (test_and_set_bit(0, (void *)&jsf0.busy) != 0) {
427 unlock_kernel();
423 return -EBUSY; 428 return -EBUSY;
429 }
424 430
431 unlock_kernel();
425 return 0; /* XXX What security? */ 432 return 0; /* XXX What security? */
426} 433}
427 434