aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/rockchip/cdn-dp-core.c
diff options
context:
space:
mode:
authorChristophe JAILLET <[email protected]>2023-09-02 17:34:31 +0000
committerHeiko Stuebner <[email protected]>2023-10-09 19:34:29 +0000
commit44b968d0d0868b7a9b7a5c64464ada464ff4d532 (patch)
tree85dde795028984d815a645d3ff36a1521f49f20d /drivers/gpu/drm/rockchip/cdn-dp-core.c
parentdrm/rockchip: vop2: Convert to use maple tree register cache (diff)
downloadkernel-44b968d0d0868b7a9b7a5c64464ada464ff4d532.tar.gz
kernel-44b968d0d0868b7a9b7a5c64464ada464ff4d532.zip
drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
cdn_dp_audio_codec_init() can fail. So add some error handling. If component_add() fails, the previous cdn_dp_audio_codec_init() call should be undone, as already done in the remove function. Fixes: 88582f564692 ("drm/rockchip: cdn-dp: Don't unregister audio dev when unbinding") Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Heiko Stuebner <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/8494a41602fadb7439630921a9779640698f2f9f.1693676045.git.christophe.jaillet@wanadoo.fr
Diffstat (limited to 'drivers/gpu/drm/rockchip/cdn-dp-core.c')
-rw-r--r--drivers/gpu/drm/rockchip/cdn-dp-core.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index a29fbafce393..3793863c210e 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -1177,6 +1177,7 @@ static int cdn_dp_probe(struct platform_device *pdev)
struct cdn_dp_device *dp;
struct extcon_dev *extcon;
struct phy *phy;
+ int ret;
int i;
dp = devm_kzalloc(dev, sizeof(*dp), GFP_KERNEL);
@@ -1217,9 +1218,19 @@ static int cdn_dp_probe(struct platform_device *pdev)
mutex_init(&dp->lock);
dev_set_drvdata(dev, dp);
- cdn_dp_audio_codec_init(dp, dev);
+ ret = cdn_dp_audio_codec_init(dp, dev);
+ if (ret)
+ return ret;
+
+ ret = component_add(dev, &cdn_dp_component_ops);
+ if (ret)
+ goto err_audio_deinit;
- return component_add(dev, &cdn_dp_component_ops);
+ return 0;
+
+err_audio_deinit:
+ platform_device_unregister(dp->audio_pdev);
+ return ret;
}
static void cdn_dp_remove(struct platform_device *pdev)