Skip to content

Commit

Permalink
drm/tegra: hdmi: Fix some error handling paths in tegra_hdmi_probe()
Browse files Browse the repository at this point in the history
[ Upstream commit 643ae131b8598fb2940c92c7d23fe62823a119c8 ]

If an error occurs after calling tegra_output_probe(),
tegra_output_remove() should be called as already done in the remove
function.

Fixes: 59d29c0 ("drm/tegra: Allocate resources at probe time")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/9b7c564eb71977678b20abd73ee52001a51cf327.1693667005.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
tititiou36 authored and Sasha Levin committed Mar 26, 2024
1 parent 85442c5 commit d81b737
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions drivers/gpu/drm/tegra/hdmi.c
Expand Up @@ -1855,12 +1855,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
return err;

hdmi->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(hdmi->regs))
return PTR_ERR(hdmi->regs);
if (IS_ERR(hdmi->regs)) {
err = PTR_ERR(hdmi->regs);
goto remove;
}

err = platform_get_irq(pdev, 0);
if (err < 0)
return err;
goto remove;

hdmi->irq = err;

Expand All @@ -1869,18 +1871,18 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(&pdev->dev, "failed to request IRQ#%u: %d\n",
hdmi->irq, err);
return err;
goto remove;
}

platform_set_drvdata(pdev, hdmi);

err = devm_pm_runtime_enable(&pdev->dev);
if (err)
return err;
goto remove;

err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
if (err)
return err;
goto remove;

INIT_LIST_HEAD(&hdmi->client.list);
hdmi->client.ops = &hdmi_client_ops;
Expand All @@ -1890,10 +1892,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev)
if (err < 0) {
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
err);
return err;
goto remove;
}

return 0;

remove:
tegra_output_remove(&hdmi->output);
return err;
}

static void tegra_hdmi_remove(struct platform_device *pdev)
Expand Down

0 comments on commit d81b737

Please sign in to comment.