]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
USB: otg: Fix bug on remove path without transceiver
authorRobert Jarzmik <robert.jarzmik@free.fr>
Wed, 22 Apr 2009 03:33:10 +0000 (20:33 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 23 Apr 2009 21:15:31 +0000 (14:15 -0700)
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>
drivers/usb/otg/otg.c

index ff318fae7d4d4d4da1f194c0c156ea46263568dc..0a43a7db750f6dc445ea4fedc771722dd07a02e3 100644 (file)
@@ -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);