devm_gpio_request is device managed and makes error handling and exit code
simpler.

Signed-off-by: Sachin Kamat <sachin.kamat at linaro.org>
---
 drivers/gpu/drm/exynos/exynos_hdmi.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c 
b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 59839cc..3fe2d61 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -2428,7 +2428,7 @@ static int __devinit hdmi_probe(struct platform_device 
*pdev)
                goto err_resource;
        }

-       ret = gpio_request(hdata->hpd_gpio, "HPD");
+       ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD");
        if (ret) {
                DRM_ERROR("failed to request HPD gpio\n");
                goto err_resource;
@@ -2438,7 +2438,7 @@ static int __devinit hdmi_probe(struct platform_device 
*pdev)
        if (i2c_add_driver(&ddc_driver)) {
                DRM_ERROR("failed to register ddc i2c driver\n");
                ret = -ENOENT;
-               goto err_gpio;
+               goto err_resource;
        }

        hdata->ddc_port = hdmi_ddc;
@@ -2501,8 +2501,6 @@ err_hdmiphy:
        i2c_del_driver(&hdmiphy_driver);
 err_ddc:
        i2c_del_driver(&ddc_driver);
-err_gpio:
-       gpio_free(hdata->hpd_gpio);
 err_resource:
        hdmi_resources_cleanup(hdata);
 err_data:
@@ -2522,8 +2520,6 @@ static int __devexit hdmi_remove(struct platform_device 
*pdev)
        free_irq(hdata->internal_irq, hdata);
        free_irq(hdata->external_irq, hdata);

-       gpio_free(hdata->hpd_gpio);
-
        hdmi_resources_cleanup(hdata);

        /* hdmiphy i2c driver */
-- 
1.7.4.1

Reply via email to