When component_add() fails, sti_hdmi_probe() returns the error without going through the release_adapter label, leaking the reference to the DDC i2c adapter that only sti_hdmi_remove() would otherwise drop. Route the failure through the label instead. Fixes: 4d5821a71ce9 ("drm/sti: hdmi use of_get_i2c_adapter_by_node interface") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang --- drivers/gpu/drm/sti/sti_hdmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index f8222e60b1e0..ed5646545f84 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -1460,7 +1460,11 @@ 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 release_adapter; + + return 0; release_adapter: i2c_put_adapter(hdmi->ddc_adapt); -- 2.34.1