Skip to content

Commit

Permalink
USB: otg: Fix bug on remove path without transceiver
Browse files Browse the repository at this point in the history
In the case where a gadget driver is removed while no
transceiver was found at probe time, a bug in
otg_put_transceiver() will trigger.

Provide symetric calls for otg_get_transceiver() and
otg_put_transceiver(), wherever a transceiver was found or
not.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Robert Jarzmik authored and Greg Kroah-Hartman committed Apr 23, 2009
1 parent 052fbc0 commit ecf85e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/usb/otg/otg.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ EXPORT_SYMBOL(otg_get_transceiver);
*/
void otg_put_transceiver(struct otg_transceiver *x)
{
put_device(x->dev);
if (x)
put_device(x->dev);
}
EXPORT_SYMBOL(otg_put_transceiver);

Expand Down

0 comments on commit ecf85e4

Please sign in to comment.