Commit 54d34920 authored by Jingoo Han's avatar Jingoo Han Committed by Samuel Ortiz

mfd: intel_msic: Use devm_gpio_request_one()

Use devm_gpio_request_one() to make cleanup paths more simple.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent bf5ea28a
...@@ -323,7 +323,8 @@ static int intel_msic_init_devices(struct intel_msic *msic) ...@@ -323,7 +323,8 @@ static int intel_msic_init_devices(struct intel_msic *msic)
if (pdata->ocd) { if (pdata->ocd) {
unsigned gpio = pdata->ocd->gpio; unsigned gpio = pdata->ocd->gpio;
ret = gpio_request_one(gpio, GPIOF_IN, "ocd_gpio"); ret = devm_gpio_request_one(&pdev->dev, gpio,
GPIOF_IN, "ocd_gpio");
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to register OCD GPIO\n"); dev_err(&pdev->dev, "failed to register OCD GPIO\n");
return ret; return ret;
...@@ -332,7 +333,6 @@ static int intel_msic_init_devices(struct intel_msic *msic) ...@@ -332,7 +333,6 @@ static int intel_msic_init_devices(struct intel_msic *msic)
ret = gpio_to_irq(gpio); ret = gpio_to_irq(gpio);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "no IRQ number for OCD GPIO\n"); dev_err(&pdev->dev, "no IRQ number for OCD GPIO\n");
gpio_free(gpio);
return ret; return ret;
} }
...@@ -359,8 +359,6 @@ static int intel_msic_init_devices(struct intel_msic *msic) ...@@ -359,8 +359,6 @@ static int intel_msic_init_devices(struct intel_msic *msic)
fail: fail:
mfd_remove_devices(&pdev->dev); mfd_remove_devices(&pdev->dev);
if (pdata->ocd)
gpio_free(pdata->ocd->gpio);
return ret; return ret;
} }
...@@ -368,12 +366,8 @@ static int intel_msic_init_devices(struct intel_msic *msic) ...@@ -368,12 +366,8 @@ static int intel_msic_init_devices(struct intel_msic *msic)
static void intel_msic_remove_devices(struct intel_msic *msic) static void intel_msic_remove_devices(struct intel_msic *msic)
{ {
struct platform_device *pdev = msic->pdev; struct platform_device *pdev = msic->pdev;
struct intel_msic_platform_data *pdata = pdev->dev.platform_data;
mfd_remove_devices(&pdev->dev); mfd_remove_devices(&pdev->dev);
if (pdata->ocd)
gpio_free(pdata->ocd->gpio);
} }
static int intel_msic_probe(struct platform_device *pdev) static int intel_msic_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment