drm/sti: hdmi: Fix bridge leak on component_add() failure
Subsystems (3)
PATCH 1/1 drm/sti: hdmi: Fix bridge leak on component_add() failure
sti_hdmi_probe() registers its bridge before adding the component. If component_add() fails, probe returns the error and leaves the bridge registered.
The remove callback unregisters the bridge, but remove is only called after a successful probe. Remove the bridge locally when component_add() fails, then continue through the existing adapter unwind path.
Signed-off-by Myeonghun Pak <[email protected]>
--- drivers/gpu/drm/sti/sti_hdmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/sti/sti_hdmi.c +8 -2
@@ -1460,9 +1460,15 @@ static int sti_hdmi_probe(struct platform_device *pdev)platform_set_drvdata (pdev, hdmi);drm_bridge_add (&hdmi->bridge); -return component_add (&pdev->dev, &sti_hdmi_ops); + ret =component_add (&pdev->dev, &sti_hdmi_ops); +if (ret) + goto bridge_remove; - release_adapter: +return 0 ; + +bridge_remove: +drm_bridge_remove (&hdmi->bridge); +release_adapter:i2c_put_adapter (hdmi->ddc_adapt);return ret;
Signature · 1 line
2.50.1