drivers/video/backlight/adp5520_bl.c: check strict_strtoul() return value
authorLiu Yuan <tailai.ly@taobao.com>
Wed, 25 May 2011 00:11:12 +0000 (17:11 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 25 May 2011 15:39:01 +0000 (08:39 -0700)
It should check if strict_strtoul() succeeds.

[akpm@linux-foundation.org: don't override strict_strtoul() return value]
Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/backlight/adp5520_bl.c

index af3119707dbfe2a65b4f9a9da2e9eadee6e5360d..d1aee730d7d80e7dd674dce346e27c812cc3e8d3 100644 (file)
@@ -211,8 +211,12 @@ static ssize_t adp5520_bl_daylight_max_store(struct device *dev,
                        const char *buf, size_t count)
 {
        struct adp5520_bl *data = dev_get_drvdata(dev);
+       int ret;
+
+       ret = strict_strtoul(buf, 10, &data->cached_daylight_max);
+       if (ret < 0)
+               return ret;
 
-       strict_strtoul(buf, 10, &data->cached_daylight_max);
        return adp5520_store(dev, buf, count, ADP5520_DAYLIGHT_MAX);
 }
 static DEVICE_ATTR(daylight_max, 0664, adp5520_bl_daylight_max_show,