Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 64d99008 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Greg Kroah-Hartman
Browse files

drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe()



[ Upstream commit 44b968d0d0868b7a9b7a5c64464ada464ff4d532 ]

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: 88582f56 ("drm/rockchip: cdn-dp: Don't unregister audio dev when unbinding")
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: default avatarHeiko Stuebner <heiko@sntech.de>
Link: https://patchwork.freedesktop.org/patch/msgid/8494a41602fadb7439630921a9779640698f2f9f.1693676045.git.christophe.jaillet@wanadoo.fr


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ddc42881
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -1147,6 +1147,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);
@@ -1187,9 +1188,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)