Commit c2807ecb authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Douglas Anderson

drm/omap: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert the omap drm driver from always returning zero in the
remove callback to the void returning variant.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230507162616.1368908-35-u.kleine-koenig@pengutronix.de
parent e52d1282
...@@ -4858,10 +4858,9 @@ static int dispc_probe(struct platform_device *pdev) ...@@ -4858,10 +4858,9 @@ static int dispc_probe(struct platform_device *pdev)
return component_add(&pdev->dev, &dispc_component_ops); return component_add(&pdev->dev, &dispc_component_ops);
} }
static int dispc_remove(struct platform_device *pdev) static void dispc_remove(struct platform_device *pdev)
{ {
component_del(&pdev->dev, &dispc_component_ops); component_del(&pdev->dev, &dispc_component_ops);
return 0;
} }
static __maybe_unused int dispc_runtime_suspend(struct device *dev) static __maybe_unused int dispc_runtime_suspend(struct device *dev)
...@@ -4913,7 +4912,7 @@ static const struct dev_pm_ops dispc_pm_ops = { ...@@ -4913,7 +4912,7 @@ static const struct dev_pm_ops dispc_pm_ops = {
struct platform_driver omap_dispchw_driver = { struct platform_driver omap_dispchw_driver = {
.probe = dispc_probe, .probe = dispc_probe,
.remove = dispc_remove, .remove_new = dispc_remove,
.driver = { .driver = {
.name = "omapdss_dispc", .name = "omapdss_dispc",
.pm = &dispc_pm_ops, .pm = &dispc_pm_ops,
......
...@@ -5044,7 +5044,7 @@ static int dsi_probe(struct platform_device *pdev) ...@@ -5044,7 +5044,7 @@ static int dsi_probe(struct platform_device *pdev)
return r; return r;
} }
static int dsi_remove(struct platform_device *pdev) static void dsi_remove(struct platform_device *pdev)
{ {
struct dsi_data *dsi = platform_get_drvdata(pdev); struct dsi_data *dsi = platform_get_drvdata(pdev);
...@@ -5060,8 +5060,6 @@ static int dsi_remove(struct platform_device *pdev) ...@@ -5060,8 +5060,6 @@ static int dsi_remove(struct platform_device *pdev)
regulator_disable(dsi->vdds_dsi_reg); regulator_disable(dsi->vdds_dsi_reg);
dsi->vdds_dsi_enabled = false; dsi->vdds_dsi_enabled = false;
} }
return 0;
} }
static __maybe_unused int dsi_runtime_suspend(struct device *dev) static __maybe_unused int dsi_runtime_suspend(struct device *dev)
...@@ -5095,7 +5093,7 @@ static const struct dev_pm_ops dsi_pm_ops = { ...@@ -5095,7 +5093,7 @@ static const struct dev_pm_ops dsi_pm_ops = {
struct platform_driver omap_dsihw_driver = { struct platform_driver omap_dsihw_driver = {
.probe = dsi_probe, .probe = dsi_probe,
.remove = dsi_remove, .remove_new = dsi_remove,
.driver = { .driver = {
.name = "omapdss_dsi", .name = "omapdss_dsi",
.pm = &dsi_pm_ops, .pm = &dsi_pm_ops,
......
...@@ -1532,7 +1532,7 @@ static int dss_probe(struct platform_device *pdev) ...@@ -1532,7 +1532,7 @@ static int dss_probe(struct platform_device *pdev)
return r; return r;
} }
static int dss_remove(struct platform_device *pdev) static void dss_remove(struct platform_device *pdev)
{ {
struct dss_device *dss = platform_get_drvdata(pdev); struct dss_device *dss = platform_get_drvdata(pdev);
...@@ -1557,8 +1557,6 @@ static int dss_remove(struct platform_device *pdev) ...@@ -1557,8 +1557,6 @@ static int dss_remove(struct platform_device *pdev)
dss_put_clocks(dss); dss_put_clocks(dss);
kfree(dss); kfree(dss);
return 0;
} }
static void dss_shutdown(struct platform_device *pdev) static void dss_shutdown(struct platform_device *pdev)
...@@ -1607,7 +1605,7 @@ static const struct dev_pm_ops dss_pm_ops = { ...@@ -1607,7 +1605,7 @@ static const struct dev_pm_ops dss_pm_ops = {
struct platform_driver omap_dsshw_driver = { struct platform_driver omap_dsshw_driver = {
.probe = dss_probe, .probe = dss_probe,
.remove = dss_remove, .remove_new = dss_remove,
.shutdown = dss_shutdown, .shutdown = dss_shutdown,
.driver = { .driver = {
.name = "omapdss_dss", .name = "omapdss_dss",
......
...@@ -824,7 +824,7 @@ static int hdmi4_probe(struct platform_device *pdev) ...@@ -824,7 +824,7 @@ static int hdmi4_probe(struct platform_device *pdev)
return r; return r;
} }
static int hdmi4_remove(struct platform_device *pdev) static void hdmi4_remove(struct platform_device *pdev)
{ {
struct omap_hdmi *hdmi = platform_get_drvdata(pdev); struct omap_hdmi *hdmi = platform_get_drvdata(pdev);
...@@ -835,7 +835,6 @@ static int hdmi4_remove(struct platform_device *pdev) ...@@ -835,7 +835,6 @@ static int hdmi4_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
kfree(hdmi); kfree(hdmi);
return 0;
} }
static const struct of_device_id hdmi_of_match[] = { static const struct of_device_id hdmi_of_match[] = {
...@@ -845,7 +844,7 @@ static const struct of_device_id hdmi_of_match[] = { ...@@ -845,7 +844,7 @@ static const struct of_device_id hdmi_of_match[] = {
struct platform_driver omapdss_hdmi4hw_driver = { struct platform_driver omapdss_hdmi4hw_driver = {
.probe = hdmi4_probe, .probe = hdmi4_probe,
.remove = hdmi4_remove, .remove_new = hdmi4_remove,
.driver = { .driver = {
.name = "omapdss_hdmi", .name = "omapdss_hdmi",
.of_match_table = hdmi_of_match, .of_match_table = hdmi_of_match,
......
...@@ -798,7 +798,7 @@ static int hdmi5_probe(struct platform_device *pdev) ...@@ -798,7 +798,7 @@ static int hdmi5_probe(struct platform_device *pdev)
return r; return r;
} }
static int hdmi5_remove(struct platform_device *pdev) static void hdmi5_remove(struct platform_device *pdev)
{ {
struct omap_hdmi *hdmi = platform_get_drvdata(pdev); struct omap_hdmi *hdmi = platform_get_drvdata(pdev);
...@@ -809,7 +809,6 @@ static int hdmi5_remove(struct platform_device *pdev) ...@@ -809,7 +809,6 @@ static int hdmi5_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
kfree(hdmi); kfree(hdmi);
return 0;
} }
static const struct of_device_id hdmi_of_match[] = { static const struct of_device_id hdmi_of_match[] = {
...@@ -820,7 +819,7 @@ static const struct of_device_id hdmi_of_match[] = { ...@@ -820,7 +819,7 @@ static const struct of_device_id hdmi_of_match[] = {
struct platform_driver omapdss_hdmi5hw_driver = { struct platform_driver omapdss_hdmi5hw_driver = {
.probe = hdmi5_probe, .probe = hdmi5_probe,
.remove = hdmi5_remove, .remove_new = hdmi5_remove,
.driver = { .driver = {
.name = "omapdss_hdmi5", .name = "omapdss_hdmi5",
.of_match_table = hdmi_of_match, .of_match_table = hdmi_of_match,
......
...@@ -865,7 +865,7 @@ static int venc_probe(struct platform_device *pdev) ...@@ -865,7 +865,7 @@ static int venc_probe(struct platform_device *pdev)
return r; return r;
} }
static int venc_remove(struct platform_device *pdev) static void venc_remove(struct platform_device *pdev)
{ {
struct venc_device *venc = platform_get_drvdata(pdev); struct venc_device *venc = platform_get_drvdata(pdev);
...@@ -876,7 +876,6 @@ static int venc_remove(struct platform_device *pdev) ...@@ -876,7 +876,6 @@ static int venc_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
kfree(venc); kfree(venc);
return 0;
} }
static __maybe_unused int venc_runtime_suspend(struct device *dev) static __maybe_unused int venc_runtime_suspend(struct device *dev)
...@@ -913,7 +912,7 @@ static const struct of_device_id venc_of_match[] = { ...@@ -913,7 +912,7 @@ static const struct of_device_id venc_of_match[] = {
struct platform_driver omap_venchw_driver = { struct platform_driver omap_venchw_driver = {
.probe = venc_probe, .probe = venc_probe,
.remove = venc_remove, .remove_new = venc_remove,
.driver = { .driver = {
.name = "omapdss_venc", .name = "omapdss_venc",
.pm = &venc_pm_ops, .pm = &venc_pm_ops,
......
...@@ -723,7 +723,7 @@ bool dmm_is_available(void) ...@@ -723,7 +723,7 @@ bool dmm_is_available(void)
return omap_dmm ? true : false; return omap_dmm ? true : false;
} }
static int omap_dmm_remove(struct platform_device *dev) static void omap_dmm_remove(struct platform_device *dev)
{ {
struct tiler_block *block, *_block; struct tiler_block *block, *_block;
int i; int i;
...@@ -763,8 +763,6 @@ static int omap_dmm_remove(struct platform_device *dev) ...@@ -763,8 +763,6 @@ static int omap_dmm_remove(struct platform_device *dev)
kfree(omap_dmm); kfree(omap_dmm);
omap_dmm = NULL; omap_dmm = NULL;
} }
return 0;
} }
static int omap_dmm_probe(struct platform_device *dev) static int omap_dmm_probe(struct platform_device *dev)
...@@ -982,8 +980,7 @@ static int omap_dmm_probe(struct platform_device *dev) ...@@ -982,8 +980,7 @@ static int omap_dmm_probe(struct platform_device *dev)
return 0; return 0;
fail: fail:
if (omap_dmm_remove(dev)) omap_dmm_remove(dev);
dev_err(&dev->dev, "cleanup failed\n");
return ret; return ret;
} }
...@@ -1213,7 +1210,7 @@ static const struct of_device_id dmm_of_match[] = { ...@@ -1213,7 +1210,7 @@ static const struct of_device_id dmm_of_match[] = {
struct platform_driver omap_dmm_driver = { struct platform_driver omap_dmm_driver = {
.probe = omap_dmm_probe, .probe = omap_dmm_probe,
.remove = omap_dmm_remove, .remove_new = omap_dmm_remove,
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = DMM_DRIVER_NAME, .name = DMM_DRIVER_NAME,
......
...@@ -821,14 +821,12 @@ static int pdev_probe(struct platform_device *pdev) ...@@ -821,14 +821,12 @@ static int pdev_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int pdev_remove(struct platform_device *pdev) static void pdev_remove(struct platform_device *pdev)
{ {
struct omap_drm_private *priv = platform_get_drvdata(pdev); struct omap_drm_private *priv = platform_get_drvdata(pdev);
omapdrm_cleanup(priv); omapdrm_cleanup(priv);
kfree(priv); kfree(priv);
return 0;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -859,7 +857,7 @@ static struct platform_driver pdev = { ...@@ -859,7 +857,7 @@ static struct platform_driver pdev = {
.pm = &omapdrm_pm_ops, .pm = &omapdrm_pm_ops,
}, },
.probe = pdev_probe, .probe = pdev_probe,
.remove = pdev_remove, .remove_new = pdev_remove,
}; };
static struct platform_driver * const drivers[] = { static struct platform_driver * const drivers[] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment