Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 344714
b: refs/heads/master
c: f4bb5cb
h: refs/heads/master
v: v3
  • Loading branch information
Sachin Kamat authored and MyungJoo Ham committed Nov 21, 2012
1 parent 7a7184f commit 745d6d3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0b672e9b21942fdfa63519fb66df4a40d6fafe35
refs/heads/master: f4bb5cb54eb97fee9b4e076df8df68b91861b934
23 changes: 8 additions & 15 deletions trunk/drivers/extcon/extcon-max77693.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,11 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
int ret, i;
u8 id;

info = kzalloc(sizeof(struct max77693_muic_info), GFP_KERNEL);
info = devm_kzalloc(&pdev->dev, sizeof(struct max77693_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;
info->max77693 = max77693;
Expand All @@ -672,10 +672,9 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
info->max77693->muic,
&max77693_muic_regmap_config);
if (IS_ERR(info->max77693->regmap_muic)) {
ret = PTR_ERR(info->max77693->regmap_muic);
dev_err(max77693->dev,
"failed to allocate register map: %d\n", ret);
goto err_regmap;
return PTR_ERR(info->max77693->regmap_muic);
}
}
platform_set_drvdata(pdev, info);
Expand Down Expand Up @@ -709,7 +708,8 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
}

/* Initialize extcon device */
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;
Expand All @@ -720,7 +720,7 @@ static int __devinit max77693_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 MUIC register by using platform data */
Expand Down Expand Up @@ -753,7 +753,7 @@ static int __devinit max77693_muic_probe(struct platform_device *pdev)
MAX77693_MUIC_REG_ID, &id);
if (ret < 0) {
dev_err(&pdev->dev, "failed to read revision number\n");
goto err_extcon;
goto err_irq;
}
dev_info(info->dev, "device ID : 0x%x\n", id);

Expand All @@ -765,14 +765,9 @@ static int __devinit max77693_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);
err_regmap:
kfree(info);
err_kfree:
return ret;
}

Expand All @@ -785,8 +780,6 @@ static int __devexit max77693_muic_remove(struct platform_device *pdev)
free_irq(muic_irqs[i].virq, info);
cancel_work_sync(&info->irq_work);
extcon_dev_unregister(info->edev);
kfree(info->edev);
kfree(info);

return 0;
}
Expand Down

0 comments on commit 745d6d3

Please sign in to comment.