summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/panel.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-10-10 11:30:59 +0200
committerIngo Molnar <mingo@kernel.org>2017-10-10 11:30:59 +0200
commit151aeab77738469ddbf0f9532e2fddd0d231aa2b (patch)
treecb1320931d458aeecd1d504575c62ad554a3417a /drivers/auxdisplay/panel.c
parent17de4ee04ca925590df036b112c1db8a778e14bf (diff)
parent024c9d2faebdad3fb43fe49ad68e91a36190f1e2 (diff)
Merge branch 'sched/urgent' into sched/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/auxdisplay/panel.c')
-rw-r--r--drivers/auxdisplay/panel.c11
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)