aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/max8997.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/max8997.c')
-rw-r--r--drivers/mfd/max8997.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index 14714058f2d2..cee098c0dae3 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -51,7 +51,7 @@ static struct mfd_cell max8997_devs[] = {
51 51
52#ifdef CONFIG_OF 52#ifdef CONFIG_OF
53static struct of_device_id max8997_pmic_dt_match[] = { 53static struct of_device_id max8997_pmic_dt_match[] = {
54 { .compatible = "maxim,max8997-pmic", .data = TYPE_MAX8997 }, 54 { .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 },
55 {}, 55 {},
56}; 56};
57#endif 57#endif
@@ -188,10 +188,11 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
188 const struct i2c_device_id *id) 188 const struct i2c_device_id *id)
189{ 189{
190 struct max8997_dev *max8997; 190 struct max8997_dev *max8997;
191 struct max8997_platform_data *pdata = i2c->dev.platform_data; 191 struct max8997_platform_data *pdata = dev_get_platdata(&i2c->dev);
192 int ret = 0; 192 int ret = 0;
193 193
194 max8997 = kzalloc(sizeof(struct max8997_dev), GFP_KERNEL); 194 max8997 = devm_kzalloc(&i2c->dev, sizeof(struct max8997_dev),
195 GFP_KERNEL);
195 if (max8997 == NULL) 196 if (max8997 == NULL)
196 return -ENOMEM; 197 return -ENOMEM;
197 198
@@ -203,14 +204,12 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
203 204
204 if (max8997->dev->of_node) { 205 if (max8997->dev->of_node) {
205 pdata = max8997_i2c_parse_dt_pdata(max8997->dev); 206 pdata = max8997_i2c_parse_dt_pdata(max8997->dev);
206 if (IS_ERR(pdata)) { 207 if (IS_ERR(pdata))
207 ret = PTR_ERR(pdata); 208 return PTR_ERR(pdata);
208 goto err;
209 }
210 } 209 }
211 210
212 if (!pdata) 211 if (!pdata)
213 goto err; 212 return ret;
214 213
215 max8997->pdata = pdata; 214 max8997->pdata = pdata;
216 max8997->ono = pdata->ono; 215 max8997->ono = pdata->ono;
@@ -250,8 +249,6 @@ err_mfd:
250 i2c_unregister_device(max8997->muic); 249 i2c_unregister_device(max8997->muic);
251 i2c_unregister_device(max8997->haptic); 250 i2c_unregister_device(max8997->haptic);
252 i2c_unregister_device(max8997->rtc); 251 i2c_unregister_device(max8997->rtc);
253err:
254 kfree(max8997);
255 return ret; 252 return ret;
256} 253}
257 254
@@ -263,7 +260,6 @@ static int max8997_i2c_remove(struct i2c_client *i2c)
263 i2c_unregister_device(max8997->muic); 260 i2c_unregister_device(max8997->muic);
264 i2c_unregister_device(max8997->haptic); 261 i2c_unregister_device(max8997->haptic);
265 i2c_unregister_device(max8997->rtc); 262 i2c_unregister_device(max8997->rtc);
266 kfree(max8997);
267 263
268 return 0; 264 return 0;
269} 265}