aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/i2c/chips/pca9539.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/i2c/chips/pca9539.c b/drivers/i2c/chips/pca9539.c
index 54b6e6a4beed..cb22280cdd27 100644
--- a/drivers/i2c/chips/pca9539.c
+++ b/drivers/i2c/chips/pca9539.c
@@ -134,11 +134,13 @@ static int pca9539_detect(struct i2c_adapter *adapter, int address, int kind)
134 new_client->driver = &pca9539_driver; 134 new_client->driver = &pca9539_driver;
135 new_client->flags = 0; 135 new_client->flags = 0;
136 136
137 /* Detection: the pca9539 only has 8 registers (0-7). 137 if (kind < 0) {
138 A read of 7 should succeed, but a read of 8 should fail. */ 138 /* Detection: the pca9539 only has 8 registers (0-7).
139 if ((i2c_smbus_read_byte_data(new_client, 7) < 0) || 139 A read of 7 should succeed, but a read of 8 should fail. */
140 (i2c_smbus_read_byte_data(new_client, 8) >= 0)) 140 if ((i2c_smbus_read_byte_data(new_client, 7) < 0) ||
141 goto exit_kfree; 141 (i2c_smbus_read_byte_data(new_client, 8) >= 0))
142 goto exit_kfree;
143 }
142 144
143 strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE); 145 strlcpy(new_client->name, "pca9539", I2C_NAME_SIZE);
144 146