diff options
-rw-r--r-- | drivers/mfd/max8997.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c index 14714058f2d2..ea1defbcf2cb 100644 --- a/drivers/mfd/max8997.c +++ b/drivers/mfd/max8997.c | |||
@@ -218,10 +218,26 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
218 | mutex_init(&max8997->iolock); | 218 | mutex_init(&max8997->iolock); |
219 | 219 | ||
220 | max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); | 220 | max8997->rtc = i2c_new_dummy(i2c->adapter, I2C_ADDR_RTC); |
221 | if (!max8997->rtc) { | ||
222 | dev_err(max8997->dev, "Failed to allocate I2C device for RTC\n"); | ||
223 | return -ENODEV; | ||
224 | } | ||
221 | i2c_set_clientdata(max8997->rtc, max8997); | 225 | i2c_set_clientdata(max8997->rtc, max8997); |
226 | |||
222 | max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); | 227 | max8997->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC); |
228 | if (!max8997->haptic) { | ||
229 | dev_err(max8997->dev, "Failed to allocate I2C device for Haptic\n"); | ||
230 | ret = -ENODEV; | ||
231 | goto err_i2c_haptic; | ||
232 | } | ||
223 | i2c_set_clientdata(max8997->haptic, max8997); | 233 | i2c_set_clientdata(max8997->haptic, max8997); |
234 | |||
224 | max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); | 235 | max8997->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC); |
236 | if (!max8997->muic) { | ||
237 | dev_err(max8997->dev, "Failed to allocate I2C device for MUIC\n"); | ||
238 | ret = -ENODEV; | ||
239 | goto err_i2c_muic; | ||
240 | } | ||
225 | i2c_set_clientdata(max8997->muic, max8997); | 241 | i2c_set_clientdata(max8997->muic, max8997); |
226 | 242 | ||
227 | pm_runtime_set_active(max8997->dev); | 243 | pm_runtime_set_active(max8997->dev); |
@@ -248,7 +264,9 @@ static int max8997_i2c_probe(struct i2c_client *i2c, | |||
248 | err_mfd: | 264 | err_mfd: |
249 | mfd_remove_devices(max8997->dev); | 265 | mfd_remove_devices(max8997->dev); |
250 | i2c_unregister_device(max8997->muic); | 266 | i2c_unregister_device(max8997->muic); |
267 | err_i2c_muic: | ||
251 | i2c_unregister_device(max8997->haptic); | 268 | i2c_unregister_device(max8997->haptic); |
269 | err_i2c_haptic: | ||
252 | i2c_unregister_device(max8997->rtc); | 270 | i2c_unregister_device(max8997->rtc); |
253 | err: | 271 | err: |
254 | kfree(max8997); | 272 | kfree(max8997); |