linux/drivers/usb/mtu3
Uwe Kleine-König 46b6fc5380 usb: mtu3: 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.

The function mtu3_remove() can only return a non-zero value if
ssusb->dr_mode is neiter USB_DR_MODE_PERIPHERAL nor USB_DR_MODE_HOST nor
USB_DR_MODE_OTG. In this case however the probe callback doesn't succeed
and so the remove callback isn't called at all. So the code branch
resulting in this error path could just be dropped were it not for the
compiler choking on "enumeration value 'USB_DR_MODE_UNKNOWN' not handled
in switch [-Werror=switch]". So instead replace this code path by a
WARN_ON and then mtu3_remove() be converted to return void trivially.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20231020151537.2202675-2-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-10-21 12:49:08 +02:00
..
Kconfig usb: mtu3: register a USB Role Switch for dual role mode 2019-09-03 20:02:15 +02:00
Makefile usb: mtu3: add tracepoints to help debug 2019-03-26 16:40:14 +09:00
mtu3_core.c usb: mtu3: fix failed runtime suspend in host only mode 2022-09-30 13:55:48 +02:00
mtu3_debug.h usb: mtu3: mtu3_debug: remove an unused struct member 2020-12-04 16:49:06 +01:00
mtu3_debugfs.c usb: mtu3: print endpoint type as string 2022-07-08 14:53:18 +02:00
mtu3_dr.c usb: mtu3: expose role-switch control to userspace 2023-04-20 11:17:05 +02:00
mtu3_dr.h usb: mtu3: support suspend/resume for dual-role mode 2021-07-27 15:58:37 +02:00
mtu3_gadget_ep0.c usb: mtu3: support function remote wakeup 2022-07-08 14:53:30 +02:00
mtu3_gadget.c usb: mtu3: unlock @mtu->lock just before giving back request 2023-04-20 11:17:05 +02:00
mtu3_host.c usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00
mtu3_hw_regs.h usb: mtu3: fix the failure of qmu stop 2023-01-19 14:12:08 +01:00
mtu3_plat.c usb: mtu3: Convert to platform remove callback returning void 2023-10-21 12:49:08 +02:00
mtu3_qmu.c usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-04-20 11:17:05 +02:00
mtu3_qmu.h USB: mtu3: Use the correct style for SPDX License Identifier 2020-04-16 14:32:48 +02:00
mtu3_trace.c usb: mtu3: mtu3_trace: Supply missing mtu3_debug.h include file 2020-07-15 17:25:57 +02:00
mtu3_trace.h Tracing updates for 5.20 / 6.0 2022-08-05 09:41:12 -07:00
mtu3.h usb: Explicitly include correct DT includes 2023-07-25 18:20:02 +02:00