Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2536566pxk; Mon, 14 Sep 2020 16:42:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwfxDjTrfKBKRu6d6eW7I9NF2lQdx9n+OlKOSqFQzpjQRyJ3LSOL0b7nz8f9uVTs27cQZt X-Received: by 2002:a05:6402:1012:: with SMTP id c18mr19452753edu.77.1600126936889; Mon, 14 Sep 2020 16:42:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600126936; cv=none; d=google.com; s=arc-20160816; b=PGEkbcWhYd7eSfu+Ay5BcYW15N7R2Yh2i7/GG9QFtt7TLITNIjNv7NQqhS54JhBXZH gHCHDneamlu12zbh9sMBv6kb+nwJKXlDM6dHDPXvL6HgcAFdMH6gsVM3OvUD3lqzHklV qBZniR3FRavPZXyYjb5Krk4NXqDozeqNGaXHpVuo9Yxok8TKrgHDprWTuctU5CmZgmpB QgHve5qqLvo+XGWQydpdbox6P3DPuP/LpfOrmYJYxHTGB+MRFV6sfao0FSFv+3636Hv8 a7ln8VOryPRzAusSEEO6YJ8pZ1YMMI96dubS1qo9hk0R6Wty96nY2AEUmO9jNuwgqFQ0 9T5Q== 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:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=+oqInsoudckynUDOreOiL+FbOcuCHEHVmtpDUVB71bk=; b=AbeXd/mJCieHJxHR35TyXjr3iBtANdeDZhMwKVKVu2sfmAyI0Ym0TebluMuTxwTisB wrEeAUdyS/auikI3yt56f04ZRvfzxaKyy5MPOSjb2JIhXoXRRmWRManGhBKL/5ypSFsw K3ODJgRPxFty2CBaeLCYwF8YEUqT4Xt/fgziNXtFLIlcyiBe2sLhSSok+wUr9BymU/e9 rEhnmVINlOg5/AuQSXoLn5yfU6OU4yr3J+xr94q4/Na7szs5wnoiKMaEVsE4QTQVdjWf oJeH/rFky63oxMUJPIt5M3wPSV+Zsfnh0L/eGra7xzOLU4dXKT5YlZklLRLV6sbEnRCx DLhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yZrILwRi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a12si7795954edt.557.2020.09.14.16.41.54; Mon, 14 Sep 2020 16:42:16 -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=yZrILwRi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726089AbgINXjI (ORCPT + 99 others); Mon, 14 Sep 2020 19:39:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:44100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726031AbgINXjE (ORCPT ); Mon, 14 Sep 2020 19:39:04 -0400 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7ACFC21D43 for ; Mon, 14 Sep 2020 23:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600126743; bh=SqboHRni2bD1vhdXq+F163RDYtXSS69vUAB3qmgkNBY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=yZrILwRiKWB3Exo04Zl6br1gc+l/7hc0rbEEUZD7eGpkF/vnTrrTegyPWxzZlH87e tb/Nrq3h6DTC2VNTI/4r9e/2B8tbTGokLt/nAf07oTEem9NBKbIYnPTedsGXImc/ry 4FBNmwk9IUb+vT8xq31IVkhGuXPDsglLsK9TiP8k= Received: by mail-ed1-f46.google.com with SMTP id a12so1192956eds.13 for ; Mon, 14 Sep 2020 16:39:03 -0700 (PDT) X-Gm-Message-State: AOAM531tNFBa3B/DYWKqq6B0IFPrQU9ZgxyaQ279nGxRTTux76lb1Szl Lc1s/JtOvXCuIV21QGUBewo+TJmBIbwr6mQ1ig== X-Received: by 2002:aa7:dcd2:: with SMTP id w18mr20041867edu.288.1600126742006; Mon, 14 Sep 2020 16:39:02 -0700 (PDT) MIME-Version: 1.0 References: <20200909084942.2122349-1-yukuai3@huawei.com> In-Reply-To: <20200909084942.2122349-1-yukuai3@huawei.com> From: Chun-Kuang Hu Date: Tue, 15 Sep 2020 07:38:51 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/mediatek: add exception handing in mtk_drm_probe() if component init fail To: Yu Kuai Cc: Chun-Kuang Hu , Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , CK Hu , Bibby Hsieh , yt.shen@mediatek.com, djkurtz@chromium.org, littlecvr@chromium.org, DRI Development , Linux ARM , "moderated list:ARM/Mediatek SoC support" , linux-kernel , yi.zhang@huawei.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Yu Kuai: Yu Kuai =E6=96=BC 2020=E5=B9=B49=E6=9C=889=E6=97=A5 = =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=884:50=E5=AF=AB=E9=81=93=EF=BC=9A > > 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. Reviewed-by: Chun-Kuang Hu > > Fixes: 119f5173628a ("drm/mediatek: Add DRM Driver for Mediatek SoC MT817= 3.") > 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/med= iatek/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 *pde= v) > pm_runtime_disable(dev); > err_node: > of_node_put(private->mutex_node); > - for (i =3D 0; i < DDP_COMPONENT_ID_MAX; i++) > + for (i =3D 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] =3D NULL; > + } > + } > return ret; > } > > -- > 2.25.4 >