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

drm/sprd: 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 sprd drm drivers from always returning zero in the
remove callback to the void returning variant.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Jyri Sarha <jyri.sarha@iki.fi>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20231102165640.3307820-33-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Thomas Zimmermann
16b01df3 0fa2db3b

+6 -11
+2 -4
drivers/gpu/drm/sprd/sprd_dpu.c
··· 859 859 return component_add(&pdev->dev, &dpu_component_ops); 860 860 } 861 861 862 - static int sprd_dpu_remove(struct platform_device *pdev) 862 + static void sprd_dpu_remove(struct platform_device *pdev) 863 863 { 864 864 component_del(&pdev->dev, &dpu_component_ops); 865 - 866 - return 0; 867 865 } 868 866 869 867 struct platform_driver sprd_dpu_driver = { 870 868 .probe = sprd_dpu_probe, 871 - .remove = sprd_dpu_remove, 869 + .remove_new = sprd_dpu_remove, 872 870 .driver = { 873 871 .name = "sprd-dpu-drv", 874 872 .of_match_table = dpu_match_table,
+2 -3
drivers/gpu/drm/sprd/sprd_drm.c
··· 138 138 return drm_of_component_probe(&pdev->dev, component_compare_of, &drm_component_ops); 139 139 } 140 140 141 - static int sprd_drm_remove(struct platform_device *pdev) 141 + static void sprd_drm_remove(struct platform_device *pdev) 142 142 { 143 143 component_master_del(&pdev->dev, &drm_component_ops); 144 - return 0; 145 144 } 146 145 147 146 static void sprd_drm_shutdown(struct platform_device *pdev) ··· 163 164 164 165 static struct platform_driver sprd_drm_driver = { 165 166 .probe = sprd_drm_probe, 166 - .remove = sprd_drm_remove, 167 + .remove_new = sprd_drm_remove, 167 168 .shutdown = sprd_drm_shutdown, 168 169 .driver = { 169 170 .name = "sprd-drm-drv",
+2 -4
drivers/gpu/drm/sprd/sprd_dsi.c
··· 1051 1051 return mipi_dsi_host_register(&dsi->host); 1052 1052 } 1053 1053 1054 - static int sprd_dsi_remove(struct platform_device *pdev) 1054 + static void sprd_dsi_remove(struct platform_device *pdev) 1055 1055 { 1056 1056 struct sprd_dsi *dsi = dev_get_drvdata(&pdev->dev); 1057 1057 1058 1058 mipi_dsi_host_unregister(&dsi->host); 1059 - 1060 - return 0; 1061 1059 } 1062 1060 1063 1061 struct platform_driver sprd_dsi_driver = { 1064 1062 .probe = sprd_dsi_probe, 1065 - .remove = sprd_dsi_remove, 1063 + .remove_new = sprd_dsi_remove, 1066 1064 .driver = { 1067 1065 .name = "sprd-dsi-drv", 1068 1066 .of_match_table = dsi_match_table,