From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C2592ECEA3; Tue, 17 Jun 2025 15:46:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750175177; cv=none; b=uHqsNuWlkXEpIyxWuZukcA/Oo83ddXVvhVxVX/d31fCzLuESWamhf7NX29DSAhXF9KRlbdUw9Ds1DR4ToUtHbmE51W0/nxODtzNiFLrK0j07UHjMQ2dJqPdGAME00FLG10uwOKicN9uTeXBF0EUqKnwYEJoofnjgLKlpMklUSdM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750175177; c=relaxed/simple; bh=vUdaIJ/nt7Cp/XmriZbmqjCbdJi+Jk+G2yJz80cWJew=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FJhOF7kMF+ptHmUCRDOndYUCeAGir2VyPW0t60nkk3uYR7qNSBAgyF94KNyZt9wifps6CSMRb3BdeCFFTpSOJAzny8wg/l05NOGheVTB9e0uf0Jp7+93ki5HWv/eBdsmy9pjSxHIeSmHGaR+W1T3PxrUnyLAFWCLTtxbjxZ2yTg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cZ88zE50; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cZ88zE50" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2690C4CEE3; Tue, 17 Jun 2025 15:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750175176; bh=vUdaIJ/nt7Cp/XmriZbmqjCbdJi+Jk+G2yJz80cWJew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cZ88zE50ci22E68+kUmQh2C8Hfh8Ac8ePvCuYWHX1GzrD72LOZ+N6yFSN/rU+RhVS ev3R/aUimIN8grUAt1S+Gwa5WR3AsaIBUSIWp/cJ4B/rXmm5+FvH9nQHVbAH8QCejK Vx0QV+xtwjJiyXz/yo7nnYAd/iUyAvzaxNOF/HtM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chen-Yu Tsai , AngeloGioacchino Del Regno , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 6.12 101/512] drm/mediatek: mtk_drm_drv: Unbind secondary mmsys components on err Date: Tue, 17 Jun 2025 17:21:07 +0200 Message-ID: <20250617152423.690900175@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152419.512865572@linuxfoundation.org> References: <20250617152419.512865572@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: AngeloGioacchino Del Regno [ Upstream commit 94c933716567084bfb9e79dcd81eb2b2308e84e1 ] When calling component_bind_all(), if a component that is included in the list fails, all of those that have been successfully bound will be unbound, but this driver has two components lists for two actual devices, as in, each mmsys instance has its own components list. In case mmsys0 (or actually vdosys0) is able to bind all of its components, but the secondary one fails, all of the components of the first are kept bound, while the ones of mmsys1/vdosys1 are correctly cleaned up. This is not right because, in case of a failure, the components are re-bound for all of the mmsys/vdosys instances without caring about the ones that were previously left in a bound state. Fix that by calling component_unbind_all() on all of the previous component masters that succeeded binding all subdevices when any of the other masters errors out. Fixes: 1ef7ed48356c ("drm/mediatek: Modify mediatek-drm for mt8195 multi mmsys support") Reviewed-by: Chen-Yu Tsai Signed-off-by: AngeloGioacchino Del Regno Link: https://patchwork.kernel.org/project/dri-devel/patch/20250403104741.71045-4-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin --- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index 3cdda6694f7f5..42e62b0409612 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -481,8 +481,11 @@ static int mtk_drm_kms_init(struct drm_device *drm) for (i = 0; i < private->data->mmsys_dev_num; i++) { drm->dev_private = private->all_drm_private[i]; ret = component_bind_all(private->all_drm_private[i]->dev, drm); - if (ret) + if (ret) { + while (--i >= 0) + component_unbind_all(private->all_drm_private[i]->dev, drm); return ret; + } } /* -- 2.39.5