Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22f9afb9 authored by Chanwoo Choi's avatar Chanwoo Choi
Browse files

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: default avatarChanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: default avatarFelipe Balbi <balbi@ti.com>
parent 739ba1bf
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -699,16 +699,15 @@ static int max8997_muic_probe(struct platform_device *pdev)
	}
	}


	/* External connector */
	/* External connector */
	info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev),
	info->edev = devm_extcon_dev_allocate(&pdev->dev, max8997_extcon_cable);
				  GFP_KERNEL);
	if (IS_ERR(info->edev)) {
	if (!info->edev) {
		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
		ret = -ENOMEM;
		ret = -ENOMEM;
		goto err_irq;
		goto err_irq;
	}
	}
	info->edev->name = DEV_NAME;
	info->edev->name = DEV_NAME;
	info->edev->dev.parent = &pdev->dev;
	info->edev->dev.parent = &pdev->dev;
	info->edev->supported_cable = max8997_extcon_cable;

	ret = devm_extcon_dev_register(&pdev->dev, info->edev);
	ret = devm_extcon_dev_register(&pdev->dev, info->edev);
	if (ret) {
	if (ret) {
		dev_err(&pdev->dev, "failed to register extcon device\n");
		dev_err(&pdev->dev, "failed to register extcon device\n");