summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/charlcd.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-10-12 12:02:50 +0300
committerThomas Gleixner <tglx@linutronix.de>2017-10-12 12:02:50 +0300
commit331b57d14829c49d75076779cdc54d7e4537bbf0 (patch)
tree79a70eadb04ed2fd65d3280021ec6ad5266d1cc1 /drivers/auxdisplay/charlcd.c
parent79761ce80aa0232157e428bde28c0cef6d43ac5f (diff)
parente43b3b58548051f8809391eb7bec7a27ed3003ea (diff)
downloadlinux-331b57d14829c49d75076779cdc54d7e4537bbf0.tar.xz
Merge branch 'irq/urgent' into x86/apic
Pick up core changes which affect the vector rework.
Diffstat (limited to 'drivers/auxdisplay/charlcd.c')
-rw-r--r--drivers/auxdisplay/charlcd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index cfeb049a01ef..642afd88870b 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -647,18 +647,25 @@ static ssize_t charlcd_write(struct file *file, const char __user *buf,
static int charlcd_open(struct inode *inode, struct file *file)
{
struct charlcd_priv *priv = to_priv(the_charlcd);
+ int ret;
+ ret = -EBUSY;
if (!atomic_dec_and_test(&charlcd_available))
- return -EBUSY; /* open only once at a time */
+ goto fail; /* open only once at a time */
+ ret = -EPERM;
if (file->f_mode & FMODE_READ) /* device is write-only */
- return -EPERM;
+ goto fail;
if (priv->must_clear) {
charlcd_clear_display(&priv->lcd);
priv->must_clear = false;
}
return nonseekable_open(inode, file);
+
+ fail:
+ atomic_inc(&charlcd_available);
+ return ret;
}
static int charlcd_release(struct inode *inode, struct file *file)