From 7a7184f0b5d7ba8c6e51bf113ce88e65af24f8dd Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 20 Nov 2012 15:46:47 +0900 Subject: [PATCH] --- yaml --- r: 344713 b: refs/heads/master c: 0b672e9b21942fdfa63519fb66df4a40d6fafe35 h: refs/heads/master i: 344711: 1a69f29e7051e56f16d01d21961cdf53f8812547 v: v3 --- [refs] | 2 +- trunk/drivers/extcon/extcon-max8997.c | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 4d1cc73067ed..c0b1f47ea160 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2ca36f4afd0b0c3b9f99e1c03bbfafeb39516cf6 +refs/heads/master: 0b672e9b21942fdfa63519fb66df4a40d6fafe35 diff --git a/trunk/drivers/extcon/extcon-max8997.c b/trunk/drivers/extcon/extcon-max8997.c index ffdbe8c962ae..8059325ce7da 100644 --- a/trunk/drivers/extcon/extcon-max8997.c +++ b/trunk/drivers/extcon/extcon-max8997.c @@ -433,11 +433,11 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev) struct max8997_muic_info *info; int ret, i; - info = kzalloc(sizeof(struct max8997_muic_info), GFP_KERNEL); + info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), + GFP_KERNEL); if (!info) { dev_err(&pdev->dev, "failed to allocate memory\n"); - ret = -ENOMEM; - goto err_kfree; + return -ENOMEM; } info->dev = &pdev->dev; @@ -471,7 +471,8 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev) } /* External connector */ - info->edev = kzalloc(sizeof(struct extcon_dev), GFP_KERNEL); + info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev), + GFP_KERNEL); if (!info->edev) { dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); ret = -ENOMEM; @@ -482,7 +483,7 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev) ret = extcon_dev_register(info->edev, NULL); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); - goto err_extcon; + goto err_irq; } /* Initialize registers according to platform data */ @@ -500,13 +501,9 @@ static int __devinit max8997_muic_probe(struct platform_device *pdev) return ret; -err_extcon: - kfree(info->edev); err_irq: while (--i >= 0) free_irq(muic_irqs[i].virq, info); - kfree(info); -err_kfree: return ret; } @@ -521,9 +518,6 @@ static int __devexit max8997_muic_remove(struct platform_device *pdev) extcon_dev_unregister(info->edev); - kfree(info->edev); - kfree(info); - return 0; }