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

usb: roles: intel_xhci: 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>
Link: https://lore.kernel.org/r/20230517230239.187727-90-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
61b013f9 456a91ce

+2 -4
+2 -4
drivers/usb/roles/intel-xhci-usb-role-switch.c
··· 195 195 return 0; 196 196 } 197 197 198 - static int intel_xhci_usb_remove(struct platform_device *pdev) 198 + static void intel_xhci_usb_remove(struct platform_device *pdev) 199 199 { 200 200 struct intel_xhci_usb_data *data = platform_get_drvdata(pdev); 201 201 ··· 203 203 204 204 usb_role_switch_unregister(data->role_sw); 205 205 fwnode_handle_put(software_node_fwnode(&intel_xhci_usb_node)); 206 - 207 - return 0; 208 206 } 209 207 210 208 static const struct platform_device_id intel_xhci_usb_table[] = { ··· 217 219 }, 218 220 .id_table = intel_xhci_usb_table, 219 221 .probe = intel_xhci_usb_probe, 220 - .remove = intel_xhci_usb_remove, 222 + .remove_new = intel_xhci_usb_remove, 221 223 }; 222 224 223 225 module_platform_driver(intel_xhci_usb_driver);