diff options
Diffstat (limited to 'drivers/auxdisplay/panel.c')
| -rw-r--r-- | drivers/auxdisplay/panel.c | 11 | 
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/auxdisplay/panel.c b/drivers/auxdisplay/panel.c index df126dcdaf18..6911acd896d9 100644 --- a/drivers/auxdisplay/panel.c +++ b/drivers/auxdisplay/panel.c @@ -1105,14 +1105,21 @@ static ssize_t keypad_read(struct file *file,  static int keypad_open(struct inode *inode, struct file *file)  { +	int ret; + +	ret = -EBUSY;  	if (!atomic_dec_and_test(&keypad_available)) -		return -EBUSY;	/* open only once at a time */ +		goto fail;	/* open only once at a time */ +	ret = -EPERM;  	if (file->f_mode & FMODE_WRITE)	/* device is read-only */ -		return -EPERM; +		goto fail;  	keypad_buflen = 0;	/* flush the buffer on opening */  	return 0; + fail: +	atomic_inc(&keypad_available); +	return ret;  }  static int keypad_release(struct inode *inode, struct file *file)  | 
