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

usb: typec: mux: gpio-sbu: 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().

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>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20230517230239.187727-91-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Uwe Kleine-König and committed by
Greg Kroah-Hartman
08cfceee 61b013f9

+2 -4
+2 -4
drivers/usb/typec/mux/gpio-sbu-mux.c
··· 137 137 return 0; 138 138 } 139 139 140 - static int gpio_sbu_mux_remove(struct platform_device *pdev) 140 + static void gpio_sbu_mux_remove(struct platform_device *pdev) 141 141 { 142 142 struct gpio_sbu_mux *sbu_mux = platform_get_drvdata(pdev); 143 143 ··· 145 145 146 146 typec_mux_unregister(sbu_mux->mux); 147 147 typec_switch_unregister(sbu_mux->sw); 148 - 149 - return 0; 150 148 } 151 149 152 150 static const struct of_device_id gpio_sbu_mux_match[] = { ··· 155 157 156 158 static struct platform_driver gpio_sbu_mux_driver = { 157 159 .probe = gpio_sbu_mux_probe, 158 - .remove = gpio_sbu_mux_remove, 160 + .remove_new = gpio_sbu_mux_remove, 159 161 .driver = { 160 162 .name = "gpio_sbu_mux", 161 163 .of_match_table = gpio_sbu_mux_match,