drm/rockchip: Balance irq refcount on failure
diff mbox

Message ID 1474050123-29897-1-git-send-email-seanpaul@chromium.org
State New
Headers show

Commit Message

Sean Paul Sept. 16, 2016, 6:22 p.m. UTC
If create_crtc fails in vop bind, ensure the irq refcount is zeroed
back out before exiting.

Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Daniel Kurtz Sept. 19, 2016, 4:18 a.m. UTC | #1
On Sat, Sep 17, 2016 at 2:22 AM, Sean Paul <seanpaul@chromium.org> wrote:
> If create_crtc fails in vop bind, ensure the irq refcount is zeroed
> back out before exiting.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>

Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>

> ---
>  drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> index 57650c9..131ae0f 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> @@ -1551,11 +1551,15 @@ static int vop_bind(struct device *dev, struct device *master, void *data)
>
>         ret = vop_create_crtc(vop);
>         if (ret)
> -               return ret;
> +               goto err_enable_irq;
>
>         pm_runtime_enable(&pdev->dev);
>
>         return 0;
> +
> +err_enable_irq:
> +       enable_irq(vop->irq); /* To balance out the disable_irq above */
> +       return ret;
>  }
>
>  static void vop_unbind(struct device *dev, struct device *master, void *data)
> --
> 2.8.0.rc3.226.g39d4020
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Patch
diff mbox

diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
index 57650c9..131ae0f 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
@@ -1551,11 +1551,15 @@  static int vop_bind(struct device *dev, struct device *master, void *data)
 
 	ret = vop_create_crtc(vop);
 	if (ret)
-		return ret;
+		goto err_enable_irq;
 
 	pm_runtime_enable(&pdev->dev);
 
 	return 0;
+
+err_enable_irq:
+	enable_irq(vop->irq); /* To balance out the disable_irq above */
+	return ret;
 }
 
 static void vop_unbind(struct device *dev, struct device *master, void *data)