From patchwork Mon Sep 21 16:28:09 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: 263713 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=unavailable 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 3CEAFC43466 for ; Mon, 21 Sep 2020 16:40:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F39BE239A1 for ; Mon, 21 Sep 2020 16:40:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706425; bh=oJrYqPbkBNlwRIqbKGRD8Px3cMwSoK4wl8bdpEKC3k4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XaAKz1/OD0rNxIoDrWS49oB52VXH8LjbE4VSCi9ZxJ339Xkb9gI8WGDeQLd3kYG+5 Wtqjr/D7yZa1OhOmfi9wuHYcvzRFCRukOG5DcKG+KyWwZSa8hBcJ7yR5tthq+w5YbL f8BppXA/O8TgcDPMlaUHhy6dtM7BBSwTdZfXj3lQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729014AbgIUQkQ (ORCPT ); Mon, 21 Sep 2020 12:40:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:42296 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728251AbgIUQj4 (ORCPT ); Mon, 21 Sep 2020 12:39:56 -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 2766323998; Mon, 21 Sep 2020 16:39:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706395; bh=oJrYqPbkBNlwRIqbKGRD8Px3cMwSoK4wl8bdpEKC3k4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6C5AUhfOkZnxctkhrNZ59b316wQmMd0YWDCvG9Tn5gAS0HiFPlIZjLurKeO3o/Su tmacRAlOXo4MSvUF6Z/GH2jAx6vJOFn0Jx0XUxMOFID/goPxhzOjx65MbEXZv6oqth eRAweYIJwkz6PzD2MNYm0nHvaAvCgKw4CYIPR66Y= 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 4.14 82/94] drm/mediatek: Add exception handing in mtk_drm_probe() if component init fail Date: Mon, 21 Sep 2020 18:28:09 +0200 Message-Id: <20200921162039.292601486@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@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 670662128edd2..f32645a33cc90 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -538,8 +538,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; }