Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5426603pxj; Wed, 23 Jun 2021 00:38:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrTtIJKFNXeDJtNQaez3uZerSW2GK1SALacUVVseqGzr4l/gHu/D7LsGIvqNwtzp1aqumz X-Received: by 2002:a17:906:7842:: with SMTP id p2mr8254299ejm.487.1624433914501; Wed, 23 Jun 2021 00:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624433914; cv=none; d=google.com; s=arc-20160816; b=bqJzUECCYpOl52cqBH618qjX8eFmIyAdDsFk0H9DZCbuQl1T/Fxq8yGta1UR7e3Bur pgUo+t8st2Xw270h1f65CKbS2kRjeZ3LkxG2DuFO+iq7lNbu+S69bAe7ozaSOkFCnM2U uMFOUuaBBNTh5dShIcOdi7hntK925EV7aQ7T40MsgYuFOtFlMB+LU91emystX8baO0SR 3+cL/1pOoPPsJukQpcSddbbLstYsTypDpt5bMT4HrYlpnmBzvQA4eCazKl8vwqwq5nVa SuxKgEq+UvfYCObMAB74DSau6GCJqau/WBSkhXBBhQD5XM7BIzUhlVm9sxd9LiOra4hA ZJwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=nzEQ8pIbi+/r6ozYD2WDB1lmKUl9aAj57E/E4OpLpIU=; b=xbOZNNLPcSinDsoIOJkj7hteb3RlsNAmiu8E62TTH9Z4NLGoypI00Y+AF2b8D3l73n +oi4Q1jI0FWF3xYXEs3fXKzPlTq15zDcp0k+/dwF8wEgrn/U1OhGCfu/z+a32jio144r FKgbZ6mUn6MCFA8ml3nFzf8YXGfqRXiBLyMdXiwIjs4no6dCdvYsD3jSN+lxaL8SmzQS a3yBqZSoHdh0l+J29Kl8juQaB5mDhj90is5iUO9zUcJZs3jC+gFucyZt8cSG7CPLkA3U IYuYTNvhru7lRvVw+PS345vVZGwusXM5/BSf/aExrFDSg6nxR/mO7egpwQJI/4NnTmS1 Y4aw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si16765689ejk.72.2021.06.23.00.38.12; Wed, 23 Jun 2021 00:38:34 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230444AbhFWHig (ORCPT + 99 others); Wed, 23 Jun 2021 03:38:36 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:32824 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229906AbhFWHiV (ORCPT ); Wed, 23 Jun 2021 03:38:21 -0400 X-UUID: d4ce259365fc4cbea0667d582b7737a2-20210623 X-UUID: d4ce259365fc4cbea0667d582b7737a2-20210623 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1741434742; Wed, 23 Jun 2021 15:35:59 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 23 Jun 2021 15:35:57 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 23 Jun 2021 15:35:57 +0800 From: Moudy Ho To: Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Hans Verkuil , Jernej Skrabec CC: Maoguang Meng , Krzysztof Kozlowski , daoyuan huang , Ping-Hsun Wu , Geert Uytterhoeven , Rob Landley , Laurent Pinchart , , , , , , , , , , , , , , , , Subject: [RFC PATCH V0 09/10] media: mtk-mdp3: revise error handling about get/probe MDP3 Date: Wed, 23 Jun 2021 15:35:48 +0800 Message-ID: <20210623073549.24170-9-moudy.ho@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210623073549.24170-1-moudy.ho@mediatek.com> References: <20210623073549.24170-1-moudy.ho@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch is used for review before send upstream patch. From Alexandre Courbot's review comment: Independent from the main patch. Revise error handling about get/probe MDP3 driver to make it stable. Signed-off-by: Moudy Ho --- drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c b/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c index eaf5b07e720f..207b55ace97b 100644 --- a/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mtk-mdp3/mtk-mdp3-core.c @@ -40,9 +40,9 @@ struct platform_device *mdp_get_plat_device(struct platform_device *pdev) } mdp_pdev = of_find_device_by_node(mdp_node); + of_node_put(mdp_node); if (WARN_ON(!mdp_pdev)) { dev_err(dev, "mdp pdev failed\n"); - of_node_put(mdp_node); return NULL; } @@ -113,7 +113,7 @@ static int mdp_probe(struct platform_device *pdev) if (!mdp->job_wq) { dev_err(dev, "Unable to create job workqueue\n"); ret = -ENOMEM; - goto err_destroy_job_wq; + goto err_deinit_comp; } mdp->clock_wq = alloc_workqueue(MDP_MODULE_NAME "-clock", WQ_FREEZABLE, @@ -121,7 +121,7 @@ static int mdp_probe(struct platform_device *pdev) if (!mdp->clock_wq) { dev_err(dev, "Unable to create clock workqueue\n"); ret = -ENOMEM; - goto err_destroy_clock_wq; + goto err_destroy_job_wq; } mdp->scp = scp_get(pdev); @@ -179,6 +179,8 @@ static int mdp_probe(struct platform_device *pdev) destroy_workqueue(mdp->clock_wq); err_destroy_job_wq: destroy_workqueue(mdp->job_wq); +err_deinit_comp: + mdp_component_deinit(mdp); err_return: dev_dbg(dev, "Errno %d\n", ret); return ret; -- 2.18.0