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

drm: exynos: dsi: 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 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() is renamed to .remove().

samsung_dsim_remove() returned 0 unconditionally. Make it return void
instead to convert the two related platform drivers to use
.remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Inki Dae <inki.dae@samsung.com>
Acked-by: Inki Dae <inki.dae@samsung.com>
Link: https://lore.kernel.org/r/20230919103939.1367659-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230919103939.1367659-1-u.kleine-koenig@pengutronix.de

authored by

Uwe Kleine-König and committed by
Neil Armstrong
c1698c73 9031e001

+4 -6
+2 -4
drivers/gpu/drm/bridge/samsung-dsim.c
··· 1998 1998 } 1999 1999 EXPORT_SYMBOL_GPL(samsung_dsim_probe); 2000 2000 2001 - int samsung_dsim_remove(struct platform_device *pdev) 2001 + void samsung_dsim_remove(struct platform_device *pdev) 2002 2002 { 2003 2003 struct samsung_dsim *dsi = platform_get_drvdata(pdev); 2004 2004 ··· 2006 2006 2007 2007 if (dsi->plat_data->host_ops && dsi->plat_data->host_ops->unregister_host) 2008 2008 dsi->plat_data->host_ops->unregister_host(dsi); 2009 - 2010 - return 0; 2011 2009 } 2012 2010 EXPORT_SYMBOL_GPL(samsung_dsim_remove); 2013 2011 ··· 2105 2107 2106 2108 static struct platform_driver samsung_dsim_driver = { 2107 2109 .probe = samsung_dsim_probe, 2108 - .remove = samsung_dsim_remove, 2110 + .remove_new = samsung_dsim_remove, 2109 2111 .driver = { 2110 2112 .name = "samsung-dsim", 2111 2113 .pm = &samsung_dsim_pm_ops,
+1 -1
drivers/gpu/drm/exynos/exynos_drm_dsi.c
··· 181 181 182 182 struct platform_driver dsi_driver = { 183 183 .probe = samsung_dsim_probe, 184 - .remove = samsung_dsim_remove, 184 + .remove_new = samsung_dsim_remove, 185 185 .driver = { 186 186 .name = "exynos-dsi", 187 187 .owner = THIS_MODULE,
+1 -1
include/drm/bridge/samsung-dsim.h
··· 116 116 }; 117 117 118 118 extern int samsung_dsim_probe(struct platform_device *pdev); 119 - extern int samsung_dsim_remove(struct platform_device *pdev); 119 + extern void samsung_dsim_remove(struct platform_device *pdev); 120 120 extern const struct dev_pm_ops samsung_dsim_pm_ops; 121 121 122 122 #endif /* __SAMSUNG_DSIM__ */