Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp162983pxk; Wed, 9 Sep 2020 01:53:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxam/AsVZpuqKTT7luXt8wY6hRng7zP+Wa53AutDYker/r+TLkdGWXx3uloo8ClBxt1GT3J X-Received: by 2002:a17:906:a2d9:: with SMTP id by25mr2708258ejb.326.1599641620642; Wed, 09 Sep 2020 01:53:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599641620; cv=none; d=google.com; s=arc-20160816; b=Xyn3iyiZeptjhHjrkqflickCXQ6D1k3OqIBCadEUlIYUbsLC4m3rVhEta5B93rqlbc lRBVNbpcEBdulzYh5V0VIT2MlPppP+RH36lVefG2s+Di/sH63gYjQxTYv1kqMrNy3rfW nKuL/LarD5Xv8EEr8tCpJ9Xfq0cwxeHUdihWvi5jB9OswHAalgCZYxbRBpwwpvZSNr5g aL0rVXKB0Z+fvUNtfnSHotWziY3MF9uL12zjsoYuw7O3O7DskcIu0fRYNp5D3U26JjFg S4v0PNaNgvCHk277wpizxug0aGvk75W7/kIUjUjGYxEhSfDThgiVfB02Hm7fhB08sjHU G3IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Tyfx3QEQxOzcb3KS0eoDNfGczoiPkGtyakkm4NbW3yU=; b=putCfTIJSvYlWmaY+T08ltH00f9R/GFUykQnw4MAKTazPFNDyf/tLKF22OVZCUqytE 8+wL2cJsHOCBpNa9DyqZNVIyI3NOAbTbSM+CohWuyKKd00ujs0lYDU0OduSy2sCPIz4m 5nzlF6hWrqRun5V5mKxryElOvHBhQZa0PySedyAcYNroS84zTQFClkTkl1hM140emAXL t2Xtadzb3M5gcMWKLldEbi6yD2SrZIJHnRim16sBCWoV5opz61WbBcjIqW5R4tb8ahwu 2uzDhx60+NYWL6Y4utL1MN18eRMd7qL47Jc+lMnBPbjEjZZ49KcdmsAHEHfFnjz4sGnj K+VA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x21si1010002ejb.137.2020.09.09.01.53.18; Wed, 09 Sep 2020 01:53:40 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729953AbgIIIui (ORCPT + 99 others); Wed, 9 Sep 2020 04:50:38 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11276 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729851AbgIIIug (ORCPT ); Wed, 9 Sep 2020 04:50:36 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id BE3BDD9DAA7DA40FD23D; Wed, 9 Sep 2020 16:50:31 +0800 (CST) Received: from huawei.com (10.175.127.227) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Wed, 9 Sep 2020 16:50:22 +0800 From: Yu Kuai To: , , , , , , , , , CC: , , , , , Subject: [PATCH] drm/mediatek: add exception handing in mtk_drm_probe() if component init fail Date: Wed, 9 Sep 2020 16:49:42 +0800 Message-ID: <20200909084942.2122349-1-yukuai3@huawei.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 040a8f393fe2..75a6cf231fd7 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -544,8 +544,13 @@ static int mtk_drm_probe(struct platform_device *pdev) 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.4