summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-08-10 22:56:15 +0200
committerJean Delvare <khali@mahadeva.delvare>2008-08-10 22:56:15 +0200
commitb25b791b13aaa336b56c4f9bd417ff126363f80b (patch)
treec19dd8eaaca361bd77b0324ccf736eac5159aa29 /drivers/i2c
parent399d6b26539d83dd734746dc2292d53fbc5807b2 (diff)
i2c: Fix NULL pointer dereference in i2c_new_probed_device
Fix a NULL pointer dereference that happened when calling i2c_new_probed_device on one of the addresses for which we use byte reads instead of quick write for detection purpose (that is: 0x30-0x37 and 0x50-0x5f). Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 7bf38c41808..c16dcad9441 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1451,9 +1451,11 @@ i2c_new_probed_device(struct i2c_adapter *adap,
if ((addr_list[i] & ~0x07) == 0x30
|| (addr_list[i] & ~0x0f) == 0x50
|| !i2c_check_functionality(adap, I2C_FUNC_SMBUS_QUICK)) {
+ union i2c_smbus_data data;
+
if (i2c_smbus_xfer(adap, addr_list[i], 0,
I2C_SMBUS_READ, 0,
- I2C_SMBUS_BYTE, NULL) >= 0)
+ I2C_SMBUS_BYTE, &data) >= 0)
break;
} else {
if (i2c_smbus_xfer(adap, addr_list[i], 0,