Commit 424e06e3 authored by Jingoo Han's avatar Jingoo Han Committed by Linus Torvalds

drivers/video/backlight/lcd.c: return ENXIO when ops functions cannot be called

Previously, when ops functions cannot be called, lcd_show_contrast() and
lcd_store_contrast() returned 0, instead of ENXIO.

Thus, in this case, a local variable 'rc' for return value should be
initialized as ENXIO, after kstrtoul() is called.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 2fe2380e
...@@ -108,7 +108,7 @@ static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr, ...@@ -108,7 +108,7 @@ static ssize_t lcd_show_power(struct device *dev, struct device_attribute *attr,
static ssize_t lcd_store_power(struct device *dev, static ssize_t lcd_store_power(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
int rc = -ENXIO; int rc;
struct lcd_device *ld = to_lcd_device(dev); struct lcd_device *ld = to_lcd_device(dev);
unsigned long power; unsigned long power;
...@@ -116,6 +116,8 @@ static ssize_t lcd_store_power(struct device *dev, ...@@ -116,6 +116,8 @@ static ssize_t lcd_store_power(struct device *dev,
if (rc) if (rc)
return rc; return rc;
rc = -ENXIO;
mutex_lock(&ld->ops_lock); mutex_lock(&ld->ops_lock);
if (ld->ops && ld->ops->set_power) { if (ld->ops && ld->ops->set_power) {
pr_debug("set power to %lu\n", power); pr_debug("set power to %lu\n", power);
...@@ -144,7 +146,7 @@ static ssize_t lcd_show_contrast(struct device *dev, ...@@ -144,7 +146,7 @@ static ssize_t lcd_show_contrast(struct device *dev,
static ssize_t lcd_store_contrast(struct device *dev, static ssize_t lcd_store_contrast(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
int rc = -ENXIO; int rc;
struct lcd_device *ld = to_lcd_device(dev); struct lcd_device *ld = to_lcd_device(dev);
unsigned long contrast; unsigned long contrast;
...@@ -152,6 +154,8 @@ static ssize_t lcd_store_contrast(struct device *dev, ...@@ -152,6 +154,8 @@ static ssize_t lcd_store_contrast(struct device *dev,
if (rc) if (rc)
return rc; return rc;
rc = -ENXIO;
mutex_lock(&ld->ops_lock); mutex_lock(&ld->ops_lock);
if (ld->ops && ld->ops->set_contrast) { if (ld->ops && ld->ops->set_contrast) {
pr_debug("set contrast to %lu\n", contrast); pr_debug("set contrast to %lu\n", contrast);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment