diff options
| author | Vincent Mailhol <[email protected]> | 2022-11-28 19:29:54 +0900 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2022-11-29 08:56:09 +0100 |
| commit | 27ef17849779edd5600aa27d1a246ad424761971 (patch) | |
| tree | e6e7c281ba57e1979af996ef27f193b2b80c9ac3 /scripts/gdb/linux/device.py | |
| parent | 01792c6036af577e4cb1aa7b9ffce7a4882c86b5 (diff) | |
usb: add usb_set_intfdata() documentation
USB drivers do not need to call usb_set_intfdata(intf, NULL) in their
usb_driver::disconnect callback because the core already does it in [1].
However, this fact is widely unknown, c.f.:
$ git grep "usb_set_intfdata(.*NULL)" | wc -l
215
Especially, setting the interface to NULL before all action completed
can result in a NULL pointer dereference. Not calling
usb_set_intfdata() at all in disconnect() is the safest method.
Add documentation to usb_set_intfdata() to clarify this point.
Also remove the call in usb-skeletion's disconnect() not to confuse
the new comers.
[1] function usb_unbind_interface() from drivers/usb/core/driver.c
Link: https://elixir.bootlin.com/linux/v6.0/source/drivers/usb/core/driver.c#L497
Signed-off-by: Vincent Mailhol <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'scripts/gdb/linux/device.py')
0 files changed, 0 insertions, 0 deletions