Merge tag 'lsk-android-14.05' into develop-3.10
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / max77693.c
index 9e60fed5ff82a81dbf774c7d8af7547f12861516..299970f99588ab7594db9bdc6093f21c0e4d5be5 100644 (file)
@@ -149,9 +149,18 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
                dev_info(max77693->dev, "device ID: 0x%x\n", reg_data);
 
        max77693->muic = i2c_new_dummy(i2c->adapter, I2C_ADDR_MUIC);
+       if (!max77693->muic) {
+               dev_err(max77693->dev, "Failed to allocate I2C device for MUIC\n");
+               return -ENODEV;
+       }
        i2c_set_clientdata(max77693->muic, max77693);
 
        max77693->haptic = i2c_new_dummy(i2c->adapter, I2C_ADDR_HAPTIC);
+       if (!max77693->haptic) {
+               dev_err(max77693->dev, "Failed to allocate I2C device for Haptic\n");
+               ret = -ENODEV;
+               goto err_i2c_haptic;
+       }
        i2c_set_clientdata(max77693->haptic, max77693);
 
        /*
@@ -187,8 +196,9 @@ err_mfd:
        max77693_irq_exit(max77693);
 err_irq:
 err_regmap_muic:
-       i2c_unregister_device(max77693->muic);
        i2c_unregister_device(max77693->haptic);
+err_i2c_haptic:
+       i2c_unregister_device(max77693->muic);
        return ret;
 }