From: Devendra Naga Date: Wed, 20 Mar 2013 04:07:43 +0000 (+1100) Subject: drivers/video/backlight/adp5520_bl.c: fix compiler warning in adp5520_show() X-Git-Tag: next-20130320~2^2~286 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f6607f00ee22d2f4d92c253eda1c2452e4a93868;p=karo-tx-linux.git drivers/video/backlight/adp5520_bl.c: fix compiler warning in adp5520_show() 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 Signed-off-by: Devendra Naga Acked-by: Jingoo Han Cc: Michael Hennerich Cc: Richard Purdie Signed-off-by: Andrew Morton --- diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 962d120f6d0d..c84701b7ca6e 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, ®_val); + ret = adp5520_read(data->master, reg, ®_val); mutex_unlock(&data->lock); + if (ret < 0) + return ret; + return sprintf(buf, "%u\n", reg_val); }