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 4FCD62F2345; Tue, 17 Jun 2025 16:01:46 +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=1750176106; cv=none; b=fHIhmn2KEdsn3qlIZQPkJkeXlqoB8GYDhZGj6g/03mXA0abbFNoo4br+HnKUPHNwhu1t3X9cMNSnBbaAJQVev8WJm8yOQW+4JKiWvIhoBjhJ4UVJaf5HEXbaTe/tlyVwBch32bGg8T6VKhU9tHcNZ/nWyp3CV+Dk9T/7MJxB8K8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750176106; c=relaxed/simple; bh=kbXny0NAXVDlF3mSdNaFMkKNclwXh/YRQCrHQwt6OSE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X5j/gXGZtPaQ/RzhSNVWO0g0bi0IR8JwBk05nbrVnpSYYHZ8aKpTukiyNMU0TYYhp3WWsk93kLHM/0jBnB62qpifRjNFl4+g4LDzTdJhKx32d5XNtTMNseRuwxKfi3D5IvV9rxOHB5wpXifwr1AADI473lwFuIbcaBOdFk19jI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=WZrqvOOt; 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="WZrqvOOt" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA719C4CEE3; Tue, 17 Jun 2025 16:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750176106; bh=kbXny0NAXVDlF3mSdNaFMkKNclwXh/YRQCrHQwt6OSE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WZrqvOOtLCCzEhghew9fppw0fx/02dYBIPBVyxCcwuEP2fmjlfqq4svgRozE8u5+h b6qZnDgTeAc3UFgFqfdo37O8vnN/a8EEcHH02JfvypX8tybzkP7lvW5yREq+IfcH2E dbbYYHGcFf8i8wDh/1aoDnNvQNDR7xBbt+C9Dk94= 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.15 152/780] drm/mediatek: mtk_drm_drv: Unbind secondary mmsys components on err Date: Tue, 17 Jun 2025 17:17:40 +0200 Message-ID: <20250617152457.692913985@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250617152451.485330293@linuxfoundation.org> References: <20250617152451.485330293@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-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 593193555c07e..7c0c12dde4885 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -488,8 +488,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