USB: otg: Fix bug on remove path without transceiver

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>
This commit is contained in:
Robert Jarzmik 2009-04-21 20:33:10 -07:00 committed by Greg Kroah-Hartman
parent 052fbc0d7f
commit ecf85e481a

View file

@ -43,7 +43,8 @@ EXPORT_SYMBOL(otg_get_transceiver);
*/ */
void otg_put_transceiver(struct otg_transceiver *x) void otg_put_transceiver(struct otg_transceiver *x)
{ {
put_device(x->dev); if (x)
put_device(x->dev);
} }
EXPORT_SYMBOL(otg_put_transceiver); EXPORT_SYMBOL(otg_put_transceiver);