From patchwork Tue Oct 17 10:16:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeffy Chen X-Patchwork-Id: 10011605 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 2BB94600CC for ; Tue, 17 Oct 2017 10:22:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1BB6628829 for ; Tue, 17 Oct 2017 10:22:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 103CC2882F; Tue, 17 Oct 2017 10:22:46 +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 C197228829 for ; Tue, 17 Oct 2017 10:22:45 +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=dYfznV+TSSBk9vf4xhYj7hY3k/HdB4fODlVy3IWL2PQ=; b=IXWLTZu6fs3Vc2vI9V0YYKRwLE FcmulXl1cH0fj0HQcY5wc7wPjLLvS7KgVoZmI9vIpbylslSujCATYQU/448rZCAgg3hRJRb7PT7sV RRRdOa3FyZ7F8Ak+BP2zmNSBzLBiPkJhNU6FdUBU8YGbWFq4k5p7kEW0XsBydC+vWqFgfCdLunmcQ uGjnv/5QPZdqJiEIy7To1rBMGDxg9YVaKCKTlsQzf4ddJxJiYIyakQW13M9f+sh89ayt5NNpzP5tG X+K+K7qaJRuwoXKaan+btB08+/gbhKf8iy6RR9XY33vtQ/vyx2ymLY4br8fOe1UZuFIbr0C2mAriv Qpow6m6A==; 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 1e4P1J-0001Nh-7g; Tue, 17 Oct 2017 10:22:45 +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 1e4OwY-00064V-UZ; Tue, 17 Oct 2017 10:17:51 +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=Eq2ajl1dzPxShFE/XX+kMQMnHfsIYkVkvjwg7rvTm4Y=; b=dMWGaiV/Iq7wFnrjtZcsenE7Y 9O8iGM7rpi0nL0Zkq5cCEBrh2BiaT9CmdayaMckRBq2UAj4ZyB9mLsaSJGl/BY0EKLZZkBDLGla7L YVhk0hk0jBibxInZoKMlcgJB/T/SC5ekr13lP8g0X2wcDE6SrSWGzkRJnS2S5epm8A3tnEVNhpmTM e538quOiB8ZMbWyeK9/dNLR+EqMrkA45GubCGMaWIDOjtbl2gCJc+M8oIus9ilOSpjv2HblfM29RS /ZUXBpabElE9yT0/gvIsn3M/2uzOwoF1fbVIK2txgXT8K+cOvuTcP+2lfBoXfbE4Gv4zU3HhaTF1V 5sLbQIdGw==; Received: from regular1.263xmail.com ([211.150.99.132]) by merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e4OwT-0007LI-5k; Tue, 17 Oct 2017 10:17:49 +0000 Received: from jeffy.chen?rock-chips.com (unknown [192.168.167.177]) by regular1.263xmail.com (Postfix) with ESMTP id A878B93FD; Tue, 17 Oct 2017 18:17:02 +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 4084E3D4; Tue, 17 Oct 2017 18:17:00 +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: <06b11edde7d9d1d659cdb6ba421e0c79> 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 659H2BYVJ; Tue, 17 Oct 2017 18:17:03 +0800 (CST) From: Jeffy Chen To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v4 5/8] drm/rockchip: inno_hdmi: Fix error handling path Date: Tue, 17 Oct 2017 18:16:21 +0800 Message-Id: <20171017101624.12506-6-jeffy.chen@rock-chips.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171017101624.12506-1-jeffy.chen@rock-chips.com> References: <20171017101624.12506-1-jeffy.chen@rock-chips.com> 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: dmitry.torokhov@gmail.com, heiko@sntech.de, David Airlie , briannorris@chromium.org, rjw@rjwysocki.net, dianders@chromium.org, dri-devel@lists.freedesktop.org, tfiga@chromium.org, linux-rockchip@lists.infradead.org, Jeffy Chen , broonie@kernel.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 error handling in bind(). Fixes: 412d4ae6b7a5 ("drm/rockchip: hdmi: add Innosilicon HDMI support") Signed-off-by: Jeffy Chen --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/gpu/drm/rockchip/inno_hdmi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index ee584d87111f..9c258b05dfa5 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: + drm_connector_cleanup(&hdmi->connector); + drm_encoder_cleanup(&hdmi->encoder); +err_put_adapter: + i2c_put_adapter(hdmi->ddc); +err_disable_clk: + clk_disable_unprepare(hdmi->pclk); return ret; }