From patchwork Wed Oct 18 12:09:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 10014571 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CA37660215 for ; Wed, 18 Oct 2017 12:13:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4B0528B36 for ; Wed, 18 Oct 2017 12:13:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8FB428B38; Wed, 18 Oct 2017 12:13:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4A44928B30 for ; Wed, 18 Oct 2017 12:13:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=p1CjXpXT00No3815JBY7S4zB5cUfVVJD5hOzNtl/P68=; b=Doa7X+WFeYNRUPqNXeLFPJuaIh k6ZJTMk2jMXyS0kbtY7FtlxUl1EV9kHmdP+lVDTyyMIFI59xcjAdODKyv3rL5zHG8cmldHcuLgYHi evilIYyrPYFZc5200CDmNoQpsobP5SAU2+/UshlWAAIc57DwKkA9n2SJf5CFfXDcZ+b2bm2oXO9Bl HGSj+Z4bfpzaZg9+PDjRafE5gMc8l+iMlsQB0EZwTCtBWeO0d3jmN+L4uw03zz8w6/yWTOpmPKzJp /s43HY9ggayg/F51WscygLMBeaGtrPINwp/06+NWmjUTV5SB+LJbOKd63XeFJo6cjiKUy1o/Jj8Nn C6KEbGzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e4nEU-0000AQ-DS; Wed, 18 Oct 2017 12:13:58 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4nCB-0006sK-Jp; Wed, 18 Oct 2017 12:11:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=YBXjMbA/FDIGRo8b7ZAlb4KN0culXXMgu9WPau9LGpA=; b=2aE+QP6vTApoCGSLga/kIEjvC WNqcvJf/u/FxePighYsuMdlAvM6/b3bMuxHq9HV5pMJ2aGd0nR8o/vC6qf2YqxQy6H97BIRo9jhWg vRlnQJYr0WcveD+B079EOfht6G1NsOa1cKzwCi0OhW3MFcc9kiH3ykyzwz6Z4wAhWZHdyTXYIbrDc 8vNDHbA4PcEWP0oUVB6PYZPOiZ4bMaydHFxs5C+LyfrkeLmkKqeW3FRa7CFrkrjGxRNix8UkpdnCf OBAYoY1h6my5xNE+SvkKGbDfTii0NdJPdvOju767Km/rYTipmdMuyvnUXTqYe/0Kl8cLI7v8o+OCp pZTGqAXPw==; Received: from regular1.263xmail.com ([211.150.99.132]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4nC7-0006Ka-I2; Wed, 18 Oct 2017 12:11:33 +0000 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.131]) by regular1.263xmail.com (Postfix) with ESMTP id 7B2B89482; Wed, 18 Oct 2017 20:10:55 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from localhost (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id BC94F360; Wed, 18 Oct 2017 20:10:54 +0800 (CST) X-RL-SENDER: jeffy.chen@rock-chips.com X-FST-TO: linux-kernel@vger.kernel.org X-SENDER-IP: 103.29.142.67 X-LOGIN-NAME: jeffy.chen@rock-chips.com X-UNIQUE-TAG: <3516625d76d80a6d03bed8009f7dc8c2> X-ATTACHMENT-NUM: 0 X-SENDER: cjf@rock-chips.com X-DNS-TYPE: 0 Received: from localhost (unknown [103.29.142.67]) by smtp.263.net (Postfix) whith ESMTP id 3548NW0XMD; Wed, 18 Oct 2017 20:10:57 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Subject: [PATCH v5 9/9] drm/rockchip: dw_hdmi: Fix error handling path Date: Wed, 18 Oct 2017 20:09:44 +0800 Message-Id: <20171018120944.7819-10-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171018120944.7819-1-jeffy.chen@rock-chips.com> References: <20171018120944.7819-1-jeffy.chen@rock-chips.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: briannorris@chromium.org, heiko@sntech.de, David Airlie , Jeffy Chen , dianders@chromium.org, dri-devel@lists.freedesktop.org, tfiga@chromium.org, linux-rockchip@lists.infradead.org, seanpaul@chromium.org, linux-arm-kernel@lists.infradead.org, Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing clk_disable_unprepare() in bind()'s error handling path and unbind(). Also inline clk_prepare_enable() with bind(). Fixes: 12b9f204e804 ("drm: bridge/dw_hdmi: add rockchip rk3288 support") Signed-off-by: Jeffy Chen --- Changes in v5: Add disable to unbind(), and inline clk_prepare_enable() with bind(). drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 791ab938f998..e936dfe6c03d 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -193,13 +193,6 @@ static int rockchip_hdmi_parse_dt(struct rockchip_hdmi *hdmi) return PTR_ERR(hdmi->grf_clk); } - ret = clk_prepare_enable(hdmi->vpll_clk); - if (ret) { - DRM_DEV_ERROR(hdmi->dev, - "Failed to enable HDMI vpll: %d\n", ret); - return ret; - } - return 0; } @@ -374,6 +367,13 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, return ret; } + ret = clk_prepare_enable(hdmi->vpll_clk); + if (ret) { + DRM_DEV_ERROR(hdmi->dev, + "Failed to enable HDMI vpll: %d\n", ret); + return ret; + } + drm_encoder_helper_add(encoder, &dw_hdmi_rockchip_encoder_helper_funcs); drm_encoder_init(drm, encoder, &dw_hdmi_rockchip_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); @@ -381,6 +381,7 @@ static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, hdmi->hdmi = dw_hdmi_bind(pdev, encoder, plat_data); if (IS_ERR(hdmi->hdmi)) { encoder->funcs->destroy(encoder); + clk_disable_unprepare(hdmi->vpll_clk); return PTR_ERR(hdmi->hdmi); } @@ -396,6 +397,7 @@ static void dw_hdmi_rockchip_unbind(struct device *dev, struct device *master, dw_hdmi_unbind(hdmi->hdmi); hdmi->encoder.funcs->destroy(&hdmi->encoder); + clk_disable_unprepare(hdmi->vpll_clk); } static const struct component_ops dw_hdmi_rockchip_ops = {