Skip to content

Commit

Permalink
drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 44b968d ]

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: 88582f5 ("drm/rockchip: cdn-dp: Don't unregister audio dev when unbinding")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/8494a41602fadb7439630921a9779640698f2f9f.1693676045.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and gregkh committed Nov 20, 2023
1 parent 112d4b0 commit d0694ef
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/gpu/drm/rockchip/cdn-dp-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,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);
Expand Down Expand Up @@ -1213,9 +1214,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 int cdn_dp_remove(struct platform_device *pdev)
Expand Down

0 comments on commit d0694ef

Please sign in to comment.