From patchwork Wed Oct 18 12:09:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 10014553 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 C14F760215 for ; Wed, 18 Oct 2017 12:11:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDA5328B2A for ; Wed, 18 Oct 2017 12:11:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B268128B2C; Wed, 18 Oct 2017 12:11:53 +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=ham 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 59C1B28B2A for ; Wed, 18 Oct 2017 12:11:53 +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=tjqY5KZwISF/ZqbeCnVGvc2yh31EIAnGCn7Wik/HJgc=; b=FgMvz78qy77/jdmb5XTJbDr/8G vuHGDQn2ZGtAY2vTZ8QCPttZcbFRwARIMNvF9unJgj+A8LJHavDt7APgn+pFCxJpywy/s6sjl9rLp cEudfvf1Mqbbq6KWEXG0Qu2isJR6g8p42ndyP68bKufLlcSxg+PI8MmvnsJyufzMiDwcjh2UnrjJu AGHZh6y9WpNxu8bl0ZEB+2G+xOiutne3V7glKDuwbQu1X87jxirIFlC+sVfZeL1esdls2662tBRU2 o1JAK77XK463Hhc1roohEU+5xSuweqFODIrRx1k1TUnOCfiuUI5PBabu2BlEOjSTwPJRFBPHS815n 7LKKLZsg==; 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 1e4nCS-00078H-9E; Wed, 18 Oct 2017 12:11:52 +0000 Received: from regular1.263xmail.com ([211.150.99.132]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4nBX-00060R-Gy; Wed, 18 Oct 2017 12:10:59 +0000 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.110]) by regular1.263xmail.com (Postfix) with ESMTP id A31129416; Wed, 18 Oct 2017 20:10:30 +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 E30FE369; Wed, 18 Oct 2017 20:10:29 +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: 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 22783H35DAL; Wed, 18 Oct 2017 20:10:32 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Subject: [PATCH v5 5/9] drm/rockchip: dw-mipi-dsi: Fix error handling path Date: Wed, 18 Oct 2017 20:09:40 +0800 Message-Id: <20171018120944.7819-6-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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171018_051056_408406_7708A619 X-CRM114-Status: UNSURE ( 7.67 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add missing pm_runtime_disable() in bind()'s error handling path. Also cleanup encoder & connector in unbind(). Fixes: 80a9a059d4e4 ("drm/rockchip/dsi: add dw-mipi power domain support") Signed-off-by: Jeffy Chen --- Changes in v5: Call the destroy hook in the error handling path like in unbind(). drivers/gpu/drm/rockchip/dw-mipi-dsi.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c index b15755b6129c..e72d4e2b61aa 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi.c @@ -1282,7 +1282,7 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = dw_mipi_dsi_register(drm, dsi); if (ret) { DRM_DEV_ERROR(dev, "Failed to register mipi_dsi: %d\n", ret); - goto err_pllref; + goto err_disable_pllref; } pm_runtime_enable(dev); @@ -1292,23 +1292,24 @@ static int dw_mipi_dsi_bind(struct device *dev, struct device *master, ret = mipi_dsi_host_register(&dsi->dsi_host); if (ret) { DRM_DEV_ERROR(dev, "Failed to register MIPI host: %d\n", ret); - goto err_cleanup; + goto err_disable_pm_runtime; } if (!dsi->panel) { ret = -EPROBE_DEFER; - goto err_mipi_dsi_host; + goto err_unreg_mipi_dsi_host; } dev_set_drvdata(dev, dsi); return 0; -err_mipi_dsi_host: +err_unreg_mipi_dsi_host: mipi_dsi_host_unregister(&dsi->dsi_host); -err_cleanup: - drm_encoder_cleanup(&dsi->encoder); - drm_connector_cleanup(&dsi->connector); -err_pllref: +err_disable_pm_runtime: + pm_runtime_disable(dev); + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); +err_disable_pllref: clk_disable_unprepare(dsi->pllref_clk); return ret; } @@ -1320,6 +1321,10 @@ static void dw_mipi_dsi_unbind(struct device *dev, struct device *master, mipi_dsi_host_unregister(&dsi->dsi_host); pm_runtime_disable(dev); + + dsi->connector.funcs->destroy(&dsi->connector); + dsi->encoder.funcs->destroy(&dsi->encoder); + clk_disable_unprepare(dsi->pllref_clk); }