Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/tegra: hdmi: Fix some error handling paths in tegra_hdmi_probe()

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

Fixes: 59d29c0ec93f ("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

authored by

Christophe JAILLET and committed by
Thierry Reding
643ae131 5286a9fc

+13 -7
+13 -7
drivers/gpu/drm/tegra/hdmi.c
··· 1856 1856 return err; 1857 1857 1858 1858 hdmi->regs = devm_platform_ioremap_resource(pdev, 0); 1859 - if (IS_ERR(hdmi->regs)) 1860 - return PTR_ERR(hdmi->regs); 1859 + if (IS_ERR(hdmi->regs)) { 1860 + err = PTR_ERR(hdmi->regs); 1861 + goto remove; 1862 + } 1861 1863 1862 1864 err = platform_get_irq(pdev, 0); 1863 1865 if (err < 0) 1864 - return err; 1866 + goto remove; 1865 1867 1866 1868 hdmi->irq = err; 1867 1869 ··· 1872 1870 if (err < 0) { 1873 1871 dev_err(&pdev->dev, "failed to request IRQ#%u: %d\n", 1874 1872 hdmi->irq, err); 1875 - return err; 1873 + goto remove; 1876 1874 } 1877 1875 1878 1876 platform_set_drvdata(pdev, hdmi); 1879 1877 1880 1878 err = devm_pm_runtime_enable(&pdev->dev); 1881 1879 if (err) 1882 - return err; 1880 + goto remove; 1883 1881 1884 1882 err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); 1885 1883 if (err) 1886 - return err; 1884 + goto remove; 1887 1885 1888 1886 INIT_LIST_HEAD(&hdmi->client.list); 1889 1887 hdmi->client.ops = &hdmi_client_ops; ··· 1893 1891 if (err < 0) { 1894 1892 dev_err(&pdev->dev, "failed to register host1x client: %d\n", 1895 1893 err); 1896 - return err; 1894 + goto remove; 1897 1895 } 1898 1896 1899 1897 return 0; 1898 + 1899 + remove: 1900 + tegra_output_remove(&hdmi->output); 1901 + return err; 1900 1902 } 1901 1903 1902 1904 static void tegra_hdmi_remove(struct platform_device *pdev)