mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeffy Chen <jeffy.chen@rock-chips.com>
To: linux-kernel@vger.kernel.org
Cc: briannorris@chromium.org, seanpaul@chromium.org,
	dianders@chromium.org, heiko@sntech.de, tfiga@chromium.org,
	Jeffy Chen <jeffy.chen@rock-chips.com>,
	Mark Yao <mark.yao@rock-chips.com>,
	dri-devel@lists.freedesktop.org,
	linux-rockchip@lists.infradead.org,
	David Airlie <airlied@linux.ie>,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 07/10] drm/rockchip: inno_hdmi: Fix error handling path
Date: Thu, 19 Oct 2017 11:48:09 +0800	[thread overview]
Message-ID: <20171019034812.13768-8-jeffy.chen@rock-chips.com> (raw)
In-Reply-To: <20171019034812.13768-1-jeffy.chen@rock-chips.com>

Add missing error handling in bind().

Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support")
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

Changes in v6: None
Changes in v5:
Call the destroy hook in the error handling path like in unbind().
Update cleanup order in unbind().

 drivers/gpu/drm/rockchip/inno_hdmi.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c
index ee584d87111f..9a96ff6b022b 100644
--- a/drivers/gpu/drm/rockchip/inno_hdmi.c
+++ b/drivers/gpu/drm/rockchip/inno_hdmi.c
@@ -851,8 +851,10 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
 	}
 
 	irq = platform_get_irq(pdev, 0);
-	if (irq < 0)
-		return irq;
+	if (irq < 0) {
+		ret = irq;
+		goto err_disable_clk;
+	}
 
 	inno_hdmi_reset(hdmi);
 
@@ -860,7 +862,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
 	if (IS_ERR(hdmi->ddc)) {
 		ret = PTR_ERR(hdmi->ddc);
 		hdmi->ddc = NULL;
-		return ret;
+		goto err_disable_clk;
 	}
 
 	/*
@@ -874,7 +876,7 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
 
 	ret = inno_hdmi_register(drm, hdmi);
 	if (ret)
-		return ret;
+		goto err_put_adapter;
 
 	dev_set_drvdata(dev, hdmi);
 
@@ -884,7 +886,17 @@ static int inno_hdmi_bind(struct device *dev, struct device *master,
 	ret = devm_request_threaded_irq(dev, irq, inno_hdmi_hardirq,
 					inno_hdmi_irq, IRQF_SHARED,
 					dev_name(dev), hdmi);
+	if (ret < 0)
+		goto err_cleanup_hdmi;
 
+	return 0;
+err_cleanup_hdmi:
+	hdmi->connector.funcs->destroy(&hdmi->connector);
+	hdmi->encoder.funcs->destroy(&hdmi->encoder);
+err_put_adapter:
+	i2c_put_adapter(hdmi->ddc);
+err_disable_clk:
+	clk_disable_unprepare(hdmi->pclk);
 	return ret;
 }
 
@@ -896,8 +908,8 @@ static void inno_hdmi_unbind(struct device *dev, struct device *master,
 	hdmi->connector.funcs->destroy(&hdmi->connector);
 	hdmi->encoder.funcs->destroy(&hdmi->encoder);
 
-	clk_disable_unprepare(hdmi->pclk);
 	i2c_put_adapter(hdmi->ddc);
+	clk_disable_unprepare(hdmi->pclk);
 }
 
 static const struct component_ops inno_hdmi_ops = {
-- 
2.11.0

  parent reply	other threads:[~2017-10-19  3:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-19  3:48 [PATCH v6 00/10] rockchip: kevin: Enable edp display Jeffy Chen
2017-10-19  3:48 ` [PATCH v6 01/10] arm64: dts: rockchip: Enable edp disaplay on kevin Jeffy Chen
2017-12-01 12:28   ` Enric Balletbo Serra
2017-12-04 17:59   ` Heiko Stuebner
2017-10-19  3:48 ` [PATCH v6 02/10] drm/rockchip: analogix_dp: Remove unnecessary init code Jeffy Chen
2017-10-20  1:48   ` Mark yao
2017-10-20 17:05     ` Sean Paul
2017-10-19  3:48 ` [PATCH v6 03/10] drm/bridge: analogix: Do not use device's drvdata Jeffy Chen
2017-10-20 16:52   ` Sean Paul
2017-10-20 23:14     ` jeffy
2017-10-19  3:48 ` [PATCH v6 04/10] drm/bridge: analogix_dp: Fix connector and encoder cleanup Jeffy Chen
2017-10-19  3:48 ` [PATCH v6 05/10] drm/rockchip: analogix_dp: Add a sanity check for rockchip_drm_psr_register() Jeffy Chen
2017-10-20  1:49   ` Mark yao
2017-10-19  3:48 ` [PATCH v6 06/10] drm/rockchip: dw-mipi-dsi: Fix error handling path Jeffy Chen
2017-10-20  1:50   ` Mark yao
2017-10-19  3:48 ` Jeffy Chen [this message]
2017-10-20  1:50   ` [PATCH v6 07/10] drm/rockchip: inno_hdmi: " Mark yao
2017-10-19  3:48 ` [PATCH v6 08/10] drm/bridge/synopsys: dw-hdmi: Add missing bridge detach Jeffy Chen
2017-10-19  3:48 ` [PATCH v6 09/10] drm/bridge/synopsys: dw-hdmi: Do not use device's drvdata Jeffy Chen
2017-10-19  3:48 ` [PATCH v6 10/10] drm/rockchip: dw_hdmi: Fix error handling path Jeffy Chen
2017-10-20  1:51   ` Mark yao
2017-10-20 17:07 ` [PATCH v6 00/10] rockchip: kevin: Enable edp display Sean Paul
2017-10-30 23:01 ` Heiko Stuebner
2017-10-31  4:37   ` JeffyChen
2017-11-01 19:33     ` Sean Paul
2017-11-10 12:15       ` Enric Balletbo Serra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171019034812.13768-8-jeffy.chen@rock-chips.com \
    --to=jeffy.chen@rock-chips.com \
    --cc=airlied@linux.ie \
    --cc=briannorris@chromium.org \
    --cc=dianders@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=heiko@sntech.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mark.yao@rock-chips.com \
    --cc=seanpaul@chromium.org \
    --cc=tfiga@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®