lkml.org 
[lkml]   [2018]   [Dec]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] backlight: (adp8870) fix a missing check for adp8870_write
Date
adp8870_write() may fail. This fix checks if adp8870_write fails, and if
so, returns its error code.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
drivers/video/backlight/adp8870_bl.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c
index 8d50e0299578..79901fb4fcd1 100644
--- a/drivers/video/backlight/adp8870_bl.c
+++ b/drivers/video/backlight/adp8870_bl.c
@@ -811,9 +811,14 @@ static ssize_t adp8870_bl_ambient_light_zone_store(struct device *dev,
if (!ret) {
reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT);
reg_val |= (val - 1) << CFGR_BLV_SHIFT;
- adp8870_write(data->client, ADP8870_CFGR, reg_val);
- }
- mutex_unlock(&data->lock);
+ ret = adp8870_write(data->client,
+ ADP8870_CFGR, reg_val);
+ if (ret) {
+ mutex_unlock(&data->lock);
+ return ret;
+ }
+ } else
+ mutex_unlock(&data->lock);
}

return count;
--
2.17.2 (Apple Git-113)
\
 
 \ /
  Last update: 2018-12-25 07:23    [W:0.059 / U:1.708 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site