aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/auxdisplay/charlcd.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-16 09:22:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-10-16 09:22:22 +0200
commit58f2c391cc0560231d7636c39d31b1b26c9396b7 (patch)
tree67956eea736a8763f67be8a52bcaf0d3fe4374f4 /drivers/auxdisplay/charlcd.c
parentvmbus: add per-channel sysfs info (diff)
parentLinux 4.14-rc5 (diff)
downloadlinux-dev-58f2c391cc0560231d7636c39d31b1b26c9396b7.tar.xz
linux-dev-58f2c391cc0560231d7636c39d31b1b26c9396b7.zip
Merge 4.14-rc5 into char-misc-next
We need the fixes in here to resolve merge issues and for testing. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
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)