Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3288624pxk; Mon, 21 Sep 2020 09:46:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEQxS+Ei3SQxdrb4I0boYYcVk+le0mWOXqtuOqw3F8pK9SE9yAa1rMxT0dhgEMIYz+7EZz X-Received: by 2002:a50:ab13:: with SMTP id s19mr493501edc.357.1600706807728; Mon, 21 Sep 2020 09:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706807; cv=none; d=google.com; s=arc-20160816; b=MQbnaz6JZMULMQj0cIxQYeL2kBcYX5aqNw5aF+4HPtmcgVrIJV5MvZNj8uNz2EmZrn lMN6Ses7G9kudeQC05fX3Vr8FMGK2YKtrh7L9bi+bu3kR5T3iuloJmPgOz2A4fSbAFN+ CLy/2Js7aqt/R1AASzyxRZDr+ONzR+pNd8KBwViORIwKTwCMTbZXKAwtdwZgBCrJipOH zc7Is1Bc150UkT7bkfWVUfKI0xylOsnRkLGL+t/9dZ6Vl9uqtPYfA+tPr6oJWsu37tMY RGgHAWxO7wxYR1Qa7rFUj+JJYPlj4yFMZdHQWZ233Zq16KTYNAPphU04/5hYisYBznUB bMMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JMxdtrUzQZwvQ0w1miq0Auf5f12AZ9se9YcNXtcmbkw=; b=JLDh4vGVyX8jm9Ep5sbrX4zbMbdgKP9OOW6NT9JaCqTgmBCpI5u3uD+ZXrLT6ccLhW Lp8t8mXd0TJXkw3iv4ObGaOSD8ZSDnSOx2dUwY5RhqWTHssycMf4v1uEvVUtVsI4/Nid NPYsxAQQLy5JOxLZ7oH+whbKdgFhLtrzK3Iqns+LPsQQpCAQNXo48vUqQ3Wo9XPmTWpF PCe0lPypg7MV52QM9sY2ioKG0xcdzpWHnDgXI1EwSQvmaC1p2ExrqQCrNAhTnfJglIFW SpLCeVPBYCaHZ8AN/YMC/wUXm5VrlKRDxeSU2fn9qkBob6K426222fZKyngzq7F6oeq2 99tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kIYl6aYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ga23si8186658ejb.691.2020.09.21.09.46.22; Mon, 21 Sep 2020 09:46:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kIYl6aYa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727904AbgIUQp0 (ORCPT + 99 others); Mon, 21 Sep 2020 12:45:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:51290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728775AbgIUQpY (ORCPT ); Mon, 21 Sep 2020 12:45:24 -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 4D16B239A1; Mon, 21 Sep 2020 16:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706723; bh=+vimZqOlSQC2uw0NxTs6No+vi69RoyYtGBfHuTLw9Xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIYl6aYaLMOBdZ2wvXshnsGjhu6+euVnlMjb13LfgMAmDKK6hUMFss0w7tgwudYSb YnuYveduGb9raT4LThSRkCWgcTy/srjZBWj7zGT5aOcjW/oeDlFpyMSP6MgaKS226m xhA3vIwd2IrIpzXZ/QBf5c7RNuSdVlf3qUWo8D50= 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.8 069/118] drm/mediatek: Add exception handing in mtk_drm_probe() if component init fail Date: Mon, 21 Sep 2020 18:28:01 +0200 Message-Id: <20200921162039.550035153@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 040a8f393fe24..7ad0433539f45 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -544,8 +544,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; } -- 2.25.1