From 47d4bb6bbcdb503b20df5dbcbf5a3bb94247875b Mon Sep 17 00:00:00 2001 From: AngeloGioacchino Del Regno Date: Wed, 26 Jul 2023 10:22:40 +0200 Subject: [PATCH] drm/mediatek: mtk_dpi: Simplify with devm_drm_bridge_add() Change drm_bridge_add() to its devm variant to slightly simplify the probe function. Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Fei Shao Reviewed-by: CK Hu Link: https://patchwork.kernel.org/project/dri-devel/patch/20230726082245.550929-2-angelogioacchino.delregno@collabora.com/ Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_dpi.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 948a53f..376006e 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -1090,11 +1090,12 @@ static int mtk_dpi_probe(struct platform_device *pdev) dpi->bridge.of_node = dev->of_node; dpi->bridge.type = DRM_MODE_CONNECTOR_DPI; - drm_bridge_add(&dpi->bridge); + ret = devm_drm_bridge_add(dev, &dpi->bridge); + if (ret) + return ret; ret = component_add(dev, &mtk_dpi_component_ops); if (ret) { - drm_bridge_remove(&dpi->bridge); dev_err(dev, "Failed to add component: %d\n", ret); return ret; } @@ -1104,10 +1105,7 @@ static int mtk_dpi_probe(struct platform_device *pdev) static int mtk_dpi_remove(struct platform_device *pdev) { - struct mtk_dpi *dpi = platform_get_drvdata(pdev); - component_del(&pdev->dev, &mtk_dpi_component_ops); - drm_bridge_remove(&dpi->bridge); return 0; } -- 2.7.4