projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
43b3a0c
)
misc/isl29020: signedness bug in als_sensing_range_store()
author
Dan Carpenter
<
[email protected]
>
Thu, 11 Nov 2010 22:05:11 +0000
(14:05 -0800)
committer
Linus Torvalds
<
[email protected]
>
Fri, 12 Nov 2010 15:55:31 +0000
(07:55 -0800)
"ret_val" is supposed to be signed here or the error handling breaks.
Also we should check the return value from i2c_smbus_read_byte_data().
Signed-off-by: Dan Carpenter <
[email protected]
>
Signed-off-by: Alan Cox <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/misc/isl29020.c
patch
|
blob
|
history
diff --git
a/drivers/misc/isl29020.c
b/drivers/misc/isl29020.c
index 34fe835921c4b751beafaff119ca97fb352e63f6..ca47e62850752b80772bd3d77a246bfe1109b742 100644
(file)
--- a/
drivers/misc/isl29020.c
+++ b/
drivers/misc/isl29020.c
@@
-87,7
+87,7
@@
static ssize_t als_sensing_range_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct i2c_client *client = to_i2c_client(dev);
-
unsigned
int ret_val;
+ int ret_val;
unsigned long val;
if (strict_strtoul(buf, 10, &val))
@@
-106,6
+106,8
@@
static ssize_t als_sensing_range_store(struct device *dev,
val = 4;
ret_val = i2c_smbus_read_byte_data(client, 0x00);
+ if (ret_val < 0)
+ return ret_val;
ret_val &= 0xFC; /*reset the bit before setting them */
ret_val |= val - 1;