[PATCH v2] video: backlight: adp5520: fix compiler warning in adp5520_show

Subsystems: adp5520 backlight driver with io expander (adp5520/adp5501), backlight class/subsystem, framebuffer layer, the rest

STALE4954d

2 messages, 2 authors, 2013-03-11 · open the first message on its own page

[PATCH v2] video: backlight: adp5520: fix compiler warning in adp5520_show

From: Devendra Naga <hidden>
Date: 2013-03-11 23:27:34

while compiling with make W=1 (gcc gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8))
found the following warning

drivers/video/backlight/adp5520_bl.c: In function ‘adp5520_show’:
drivers/video/backlight/adp5520_bl.c:146:6: warning: variable ‘error’ set but not used [-Wunused-but-set-variable]

fixed by checking the return value of the variable

Cc: Jingoo Han <redacted>
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Richard Purdie <redacted>
Signed-off-by: Devendra Naga <redacted>
---
 drivers/video/backlight/adp5520_bl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index a1e41d4..d923f23 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -143,13 +143,16 @@ static int adp5520_bl_setup(struct backlight_device *bl)
 static ssize_t adp5520_show(struct device *dev, char *buf, int reg)
 {
 	struct adp5520_bl *data = dev_get_drvdata(dev);
-	int error;
+	int ret;
 	uint8_t reg_val;
 
 	mutex_lock(&data->lock);
-	error = adp5520_read(data->master, reg, &reg_val);
+	ret = adp5520_read(data->master, reg, &reg_val);
 	mutex_unlock(&data->lock);
 
+	if (ret < 0)
+		return ret;
+
 	return sprintf(buf, "%u\n", reg_val);
 }
 
-- 
1.8.1.2

Re: [PATCH v2] video: backlight: adp5520: fix compiler warning in adp5520_show

From: Jingoo Han <hidden>
Date: 2013-03-11 23:52:18

On Tuesday, March 12, 2013 8:28 AM, Devendra Naga wrote:
while compiling with make W=1 (gcc gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8))
found the following warning

drivers/video/backlight/adp5520_bl.c: In function ‘adp5520_show’:
drivers/video/backlight/adp5520_bl.c:146:6: warning: variable ‘error’ set but not used [-Wunused-but-
set-variable]

fixed by checking the return value of the variable

Cc: Jingoo Han <redacted>
Acked-by: Jingoo Han <redacted>

Best regards,
Jingoo Han
quoted hunk
Cc: Michael Hennerich <michael.hennerich@analog.com>
Cc: Richard Purdie <redacted>
Signed-off-by: Devendra Naga <redacted>
---
 drivers/video/backlight/adp5520_bl.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c
index a1e41d4..d923f23 100644
--- a/drivers/video/backlight/adp5520_bl.c
+++ b/drivers/video/backlight/adp5520_bl.c
@@ -143,13 +143,16 @@ static int adp5520_bl_setup(struct backlight_device *bl)
 static ssize_t adp5520_show(struct device *dev, char *buf, int reg)
 {
 	struct adp5520_bl *data = dev_get_drvdata(dev);
-	int error;
+	int ret;
 	uint8_t reg_val;

 	mutex_lock(&data->lock);
-	error = adp5520_read(data->master, reg, &reg_val);
+	ret = adp5520_read(data->master, reg, &reg_val);
 	mutex_unlock(&data->lock);

+	if (ret < 0)
+		return ret;
+
 	return sprintf(buf, "%u\n", reg_val);
 }

--
1.8.1.2

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help