Message ID | 20240304091005.717012-2-u.kleine-koenig@pengutronix.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/bridge: imx8mp-hdmi-tx: Convert to platform remove callback returning void | expand |
On Mon, 4 Mar 2024 10:10:06 +0100, Uwe Kleine-König wrote: > 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 ignored (apart > from emitting a warning) 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. Eventually after all drivers > are converted, .remove_new() will be renamed to .remove(). > > [...] Applied, thanks! [1/1] drm/bridge: imx8mp-hdmi-tx: Convert to platform remove callback returning void https://cgit.freedesktop.org/drm/drm-misc/commit/?id=2caad4f7b024 Rob
Hello Rob, On Wed, Apr 10, 2024 at 03:40:30PM +0200, Robert Foss wrote: > On Mon, 4 Mar 2024 10:10:06 +0100, Uwe Kleine-König wrote: > > 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 ignored (apart > > from emitting a warning) 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. Eventually after all drivers > > are converted, .remove_new() will be renamed to .remove(). > > > > [...] > > Applied, thanks! > > [1/1] drm/bridge: imx8mp-hdmi-tx: Convert to platform remove callback returning void > https://cgit.freedesktop.org/drm/drm-misc/commit/?id=2caad4f7b024 Thank you, very appreciated! Uwe
diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c index 89fc432ac611..13bc570c5473 100644 --- a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c @@ -104,13 +104,11 @@ static int imx8mp_dw_hdmi_probe(struct platform_device *pdev) return 0; } -static int imx8mp_dw_hdmi_remove(struct platform_device *pdev) +static void imx8mp_dw_hdmi_remove(struct platform_device *pdev) { struct imx8mp_hdmi *hdmi = platform_get_drvdata(pdev); dw_hdmi_remove(hdmi->dw_hdmi); - - return 0; } static int __maybe_unused imx8mp_dw_hdmi_pm_suspend(struct device *dev) @@ -140,7 +138,7 @@ MODULE_DEVICE_TABLE(of, imx8mp_dw_hdmi_of_table); static struct platform_driver imx8mp_dw_hdmi_platform_driver = { .probe = imx8mp_dw_hdmi_probe, - .remove = imx8mp_dw_hdmi_remove, + .remove_new = imx8mp_dw_hdmi_remove, .driver = { .name = "imx8mp-dw-hdmi-tx", .of_match_table = imx8mp_dw_hdmi_of_table,
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 ignored (apart from emitting a warning) 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. Eventually after all drivers are converted, .remove_new() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- Hello, note this driver is currently only available in next. Best regards Uwe drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) base-commit: 67908bf6954b7635d33760ff6dfc189fc26ccc89