diff options
Diffstat (limited to 'drivers/power/max8998_charger.c')
-rw-r--r-- | drivers/power/max8998_charger.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/power/max8998_charger.c b/drivers/power/max8998_charger.c index bf677e3daec9..5017470c2fc9 100644 --- a/drivers/power/max8998_charger.c +++ b/drivers/power/max8998_charger.c | |||
@@ -88,7 +88,8 @@ static int max8998_battery_probe(struct platform_device *pdev) | |||
88 | return -ENODEV; | 88 | return -ENODEV; |
89 | } | 89 | } |
90 | 90 | ||
91 | max8998 = kzalloc(sizeof(struct max8998_battery_data), GFP_KERNEL); | 91 | max8998 = devm_kzalloc(&pdev->dev, sizeof(struct max8998_battery_data), |
92 | GFP_KERNEL); | ||
92 | if (!max8998) | 93 | if (!max8998) |
93 | return -ENOMEM; | 94 | return -ENOMEM; |
94 | 95 | ||
@@ -174,7 +175,6 @@ static int max8998_battery_probe(struct platform_device *pdev) | |||
174 | 175 | ||
175 | return 0; | 176 | return 0; |
176 | err: | 177 | err: |
177 | kfree(max8998); | ||
178 | return ret; | 178 | return ret; |
179 | } | 179 | } |
180 | 180 | ||
@@ -183,7 +183,6 @@ static int max8998_battery_remove(struct platform_device *pdev) | |||
183 | struct max8998_battery_data *max8998 = platform_get_drvdata(pdev); | 183 | struct max8998_battery_data *max8998 = platform_get_drvdata(pdev); |
184 | 184 | ||
185 | power_supply_unregister(&max8998->battery); | 185 | power_supply_unregister(&max8998->battery); |
186 | kfree(max8998); | ||
187 | 186 | ||
188 | return 0; | 187 | return 0; |
189 | } | 188 | } |