aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/max8998.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/max8998.c')
-rw-r--r--drivers/mfd/max8998.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
index 21af51a499f4..fe6332dcabee 100644
--- a/drivers/mfd/max8998.c
+++ b/drivers/mfd/max8998.c
@@ -184,11 +184,12 @@ static inline int max8998_i2c_get_driver_data(struct i2c_client *i2c,
184static int max8998_i2c_probe(struct i2c_client *i2c, 184static int max8998_i2c_probe(struct i2c_client *i2c,
185 const struct i2c_device_id *id) 185 const struct i2c_device_id *id)
186{ 186{
187 struct max8998_platform_data *pdata = i2c->dev.platform_data; 187 struct max8998_platform_data *pdata = dev_get_platdata(&i2c->dev);
188 struct max8998_dev *max8998; 188 struct max8998_dev *max8998;
189 int ret = 0; 189 int ret = 0;
190 190
191 max8998 = kzalloc(sizeof(struct max8998_dev), GFP_KERNEL); 191 max8998 = devm_kzalloc(&i2c->dev, sizeof(struct max8998_dev),
192 GFP_KERNEL);
192 if (max8998 == NULL) 193 if (max8998 == NULL)
193 return -ENOMEM; 194 return -ENOMEM;
194 195
@@ -246,7 +247,6 @@ err:
246 mfd_remove_devices(max8998->dev); 247 mfd_remove_devices(max8998->dev);
247 max8998_irq_exit(max8998); 248 max8998_irq_exit(max8998);
248 i2c_unregister_device(max8998->rtc); 249 i2c_unregister_device(max8998->rtc);
249 kfree(max8998);
250 return ret; 250 return ret;
251} 251}
252 252
@@ -257,7 +257,6 @@ static int max8998_i2c_remove(struct i2c_client *i2c)
257 mfd_remove_devices(max8998->dev); 257 mfd_remove_devices(max8998->dev);
258 max8998_irq_exit(max8998); 258 max8998_irq_exit(max8998);
259 i2c_unregister_device(max8998->rtc); 259 i2c_unregister_device(max8998->rtc);
260 kfree(max8998);
261 260
262 return 0; 261 return 0;
263} 262}