From patchwork Wed Dec 8 15:12:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sascha Hauer X-Patchwork-Id: 12695367 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DEC6CC433F5 for ; Wed, 8 Dec 2021 15:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+0ED/WsvEv69z/a6O2lqxPha1+hNq7D9UUd5ds6W/c4=; b=1Y0PxlsRitA7dC a0n/RHnDrd3+enLvJuQ8qBols/oTa5ASSo7yfF4OJK4PHwh8mOuww0Q4OhGc4GN84FWf7S8H1wTt0 B3R2xpzYQgHDvjDG0sbBv0LdqxR8bFLeHknUh9VN2u81mT2mGDhB5H3bsqN7stTQ/ad7l5VF8qChX LUjr15V3bio9Ugl290kT9jlnIlRQ/bEpcbGKFPzXrQhyp1HbhFuETvsfXYa/kaOxA51wj9QOdCCWk iXlCvC9fSGPc4w06V7qzb8X1vwbKb363X+PJaBEGsFGs7vmDi61hBYLPC3PsKDP3TsdpdiWSrhGgJ idv7dNicHxqw73ShHNBQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muyiz-00DAp1-3Q; Wed, 08 Dec 2021 15:19:17 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muydA-00D7bL-P4 for linux-arm-kernel@bombadil.infradead.org; Wed, 08 Dec 2021 15:13:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=mRODe0f3nBnyvSCrJmqepyjojn09sZu60JhmnzLovwo=; b=Vxq514iCa5mbI5XA6X5NJprkqB h7tt5oNFo50mkDSGMIkWwck+cQHXLkb1cQe6HaIMl0V4c7KCLfj8dhQs5c5Y4nIxFXvsCTiJhMa5I VrHv/WqIvYGePcrMoas8rV/0eVnSWbJTFjtip9hFpDCh2pIBYMDp+eAojKTXJoIuHNb/T6J39VE52 6kzDZRG7W6V6MMNHabCOx2rX6UxLIRBWT/r3WdnY3hIsvFg16WAzcnhEJGyosHJOXFro6jJhkiToQ 8Sfwu2qdUKWgY+g95D6+vPw6Q4gLaTJHEo0SSjRfV0C6BudCcJTFx2G1gUTaidRMCJwpdDWNVwUyb tb0l8zxA==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muyd3-000Cb8-SM for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 15:13:15 +0000 Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muyck-0004UM-7C; Wed, 08 Dec 2021 16:12:50 +0100 Received: from sha by dude02.hi.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1muycc-00FVZ6-Sv; Wed, 08 Dec 2021 16:12:42 +0100 From: Sascha Hauer To: dri-devel@lists.freedesktop.org Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, devicetree@vger.kernel.org, kernel@pengutronix.de, Andy Yan , Benjamin Gaignard , Michael Riesch , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Peter Geis , Sascha Hauer Subject: [PATCH 01/18] drm/rockchip: dw_hdmi: Do not leave clock enabled in error case Date: Wed, 8 Dec 2021 16:12:13 +0100 Message-Id: <20211208151230.3695378-2-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211208151230.3695378-1-s.hauer@pengutronix.de> References: <20211208151230.3695378-1-s.hauer@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_151310_086274_2FA70171 X-CRM114-Status: GOOD ( 12.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver returns an error when devm_phy_optional_get() fails leaving the previously enabled clock turned on. Change order and enable the clock only after the phy has been acquired. Signed-off-by: Sascha Hauer --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index 830bdd5e9b7ce..8677c82716784 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -529,13 +529,6 @@ 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; - } - hdmi->phy = devm_phy_optional_get(dev, "hdmi"); if (IS_ERR(hdmi->phy)) { ret = PTR_ERR(hdmi->phy); @@ -544,6 +537,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_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);