diff options
author | Chanwoo Choi <cw00.choi@samsung.com> | 2014-04-21 07:37:51 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2014-04-28 20:46:28 -0400 |
commit | 22f9afb95ba67eb6839e2b5499f5f42a767b1c18 (patch) | |
tree | 78b688c97d20fda37d38d6149e84a9e628432bf7 /drivers/extcon/extcon-max8997.c | |
parent | 739ba1bfdb15e773999aafddbd6c59b5737797a0 (diff) |
extcon: max8997: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/extcon/extcon-max8997.c')
-rw-r--r-- | drivers/extcon/extcon-max8997.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 804a446fecdc..d9f7f1baaa03 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c | |||
@@ -699,16 +699,15 @@ static int max8997_muic_probe(struct platform_device *pdev) | |||
699 | } | 699 | } |
700 | 700 | ||
701 | /* External connector */ | 701 | /* External connector */ |
702 | info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev), | 702 | info->edev = devm_extcon_dev_allocate(&pdev->dev, max8997_extcon_cable); |
703 | GFP_KERNEL); | 703 | if (IS_ERR(info->edev)) { |
704 | if (!info->edev) { | ||
705 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); | 704 | dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); |
706 | ret = -ENOMEM; | 705 | ret = -ENOMEM; |
707 | goto err_irq; | 706 | goto err_irq; |
708 | } | 707 | } |
709 | info->edev->name = DEV_NAME; | 708 | info->edev->name = DEV_NAME; |
710 | info->edev->dev.parent = &pdev->dev; | 709 | info->edev->dev.parent = &pdev->dev; |
711 | info->edev->supported_cable = max8997_extcon_cable; | 710 | |
712 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); | 711 | ret = devm_extcon_dev_register(&pdev->dev, info->edev); |
713 | if (ret) { | 712 | if (ret) { |
714 | dev_err(&pdev->dev, "failed to register extcon device\n"); | 713 | dev_err(&pdev->dev, "failed to register extcon device\n"); |