summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/panel.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-10-10 12:46:55 +0300
committerIngo Molnar <mingo@kernel.org>2017-10-10 12:46:55 +0300
commitaf1a34f21150af199f066dfcccbae9830c9429aa (patch)
tree313267459418f7bba8510df45ce18d4b4133eb1b /drivers/auxdisplay/panel.c
parent39208aa7ecb7d9c4e86df782b5693270313cbab1 (diff)
parentc7e2f69d3ed2e56de1f5eaaf37c0f5f91d7adb0a (diff)
downloadlinux-af1a34f21150af199f066dfcccbae9830c9429aa.tar.xz
Merge branch 'locking/urgent' into locking/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)