diff options
author | Vincent Mailhol <mailhol.vincent@wanadoo.fr> | 2022-11-28 19:29:54 +0900 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-11-29 08:56:09 +0100 |
commit | 27ef17849779edd5600aa27d1a246ad424761971 (patch) | |
tree | e6e7c281ba57e1979af996ef27f193b2b80c9ac3 /drivers/usb/host | |
parent | 01792c6036af577e4cb1aa7b9ffce7a4882c86b5 (diff) | |
download | linux-27ef17849779edd5600aa27d1a246ad424761971.tar.bz2 |
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 <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/r/20221128102954.3615579-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
0 files changed, 0 insertions, 0 deletions