From patchwork Mon Sep 21 16:31:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "gregkh@linuxfoundation.org" X-Patchwork-Id: 309384 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60344C43465 for ; Mon, 21 Sep 2020 16:52:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C4FA2076E for ; Mon, 21 Sep 2020 16:52:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600707136; bh=Riijk3UqEecBsw4LVr/zzFLEEcR9pY8INu7hzuIN+yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FPGik2Iac6a6xWoOhfcw6jBeTGhnenDGFUyELIHQIzcn1nKKqUWUFDTLTkMk0QeAB l9hyLXxM4z4y8Zw/oG5JZvtss2rkhpkP8oM+AniiZrs1yBuSUUbY8x4g7lnshgO1b5 yzzsf8wyHtj2/SY/A9pRZRsUcJXSk4pFL9/KN/EQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729948AbgIUQwP (ORCPT ); Mon, 21 Sep 2020 12:52:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:57456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729905AbgIUQt1 (ORCPT ); Mon, 21 Sep 2020 12:49:27 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 771B1238A1; Mon, 21 Sep 2020 16:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706967; bh=Riijk3UqEecBsw4LVr/zzFLEEcR9pY8INu7hzuIN+yE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4b9W65bGExv6mUkHbqqmQs13bEgGtmFC2K0ILe67zuphmTnTFqh5w3qK244Sbv5/ 75tVimUGl4TxGGgf9cEMeEOTSJb9b9qX0CxfZIIBrSVCVPSqua2HsBIYvVVeU+Jxhu ijc5KZUZVN0R80GUsBx/faGOsQ2s6At1NCx725j4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.4 45/72] drm/mediatek: Add exception handing in mtk_drm_probe() if component init fail Date: Mon, 21 Sep 2020 18:31:24 +0200 Message-Id: <20200921163124.017779167@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921163121.870386357@linuxfoundation.org> References: <20200921163121.870386357@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Yu Kuai [ Upstream commit 64c194c00789889b0f9454f583712f079ba414ee ] mtk_ddp_comp_init() is called in a loop in mtk_drm_probe(), if it fail, previous successive init component is not proccessed. Thus uninitialize valid component and put their device if component init failed. Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT8173.") Signed-off-by: Yu Kuai Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 352b81a7a6702..f98bb2e263723 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -594,8 +594,13 @@ err_pm: pm_runtime_disable(dev); err_node: of_node_put(private->mutex_node); - for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) + for (i = 0; i < DDP_COMPONENT_ID_MAX; i++) { of_node_put(private->comp_node[i]); + if (private->ddp_comp[i]) { + put_device(private->ddp_comp[i]->larb_dev); + private->ddp_comp[i] = NULL; + } + } return ret; }