aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-02-20 04:29:53 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2013-04-08 11:25:26 -0400
commit0287714b45c601789401e2ce28e45ea50925e419 (patch)
tree88636e33eeefd8696cdac71651b04558ce6cb86a /drivers/mfd
parent71f4b9cdfccfb82cff702fe61f4ace97a1dfb0e0 (diff)
mfd: aat2870: Use use devm_*() functions
Use devm_*() functions to make cleanup paths more simple. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/aat2870-core.c20
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index f1beb4971f87..dfdb0a2b6835 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -367,12 +367,12 @@ static int aat2870_i2c_probe(struct i2c_client *client,
367 int i, j; 367 int i, j;
368 int ret = 0; 368 int ret = 0;
369 369
370 aat2870 = kzalloc(sizeof(struct aat2870_data), GFP_KERNEL); 370 aat2870 = devm_kzalloc(&client->dev, sizeof(struct aat2870_data),
371 GFP_KERNEL);
371 if (!aat2870) { 372 if (!aat2870) {
372 dev_err(&client->dev, 373 dev_err(&client->dev,
373 "Failed to allocate memory for aat2870\n"); 374 "Failed to allocate memory for aat2870\n");
374 ret = -ENOMEM; 375 return -ENOMEM;
375 goto out;
376 } 376 }
377 377
378 aat2870->dev = &client->dev; 378 aat2870->dev = &client->dev;
@@ -400,12 +400,12 @@ static int aat2870_i2c_probe(struct i2c_client *client,
400 aat2870->init(aat2870); 400 aat2870->init(aat2870);
401 401
402 if (aat2870->en_pin >= 0) { 402 if (aat2870->en_pin >= 0) {
403 ret = gpio_request_one(aat2870->en_pin, GPIOF_OUT_INIT_HIGH, 403 ret = devm_gpio_request_one(&client->dev, aat2870->en_pin,
404 "aat2870-en"); 404 GPIOF_OUT_INIT_HIGH, "aat2870-en");
405 if (ret < 0) { 405 if (ret < 0) {
406 dev_err(&client->dev, 406 dev_err(&client->dev,
407 "Failed to request GPIO %d\n", aat2870->en_pin); 407 "Failed to request GPIO %d\n", aat2870->en_pin);
408 goto out_kfree; 408 return ret;
409 } 409 }
410 } 410 }
411 411
@@ -436,11 +436,6 @@ static int aat2870_i2c_probe(struct i2c_client *client,
436 436
437out_disable: 437out_disable:
438 aat2870_disable(aat2870); 438 aat2870_disable(aat2870);
439 if (aat2870->en_pin >= 0)
440 gpio_free(aat2870->en_pin);
441out_kfree:
442 kfree(aat2870);
443out:
444 return ret; 439 return ret;
445} 440}
446 441
@@ -452,11 +447,8 @@ static int aat2870_i2c_remove(struct i2c_client *client)
452 447
453 mfd_remove_devices(aat2870->dev); 448 mfd_remove_devices(aat2870->dev);
454 aat2870_disable(aat2870); 449 aat2870_disable(aat2870);
455 if (aat2870->en_pin >= 0)
456 gpio_free(aat2870->en_pin);
457 if (aat2870->uninit) 450 if (aat2870->uninit)
458 aat2870->uninit(aat2870); 451 aat2870->uninit(aat2870);
459 kfree(aat2870);
460 452
461 return 0; 453 return 0;
462} 454}