aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/otg/otg.c
diff options
context:
space:
mode:
authorRobert Jarzmik <robert.jarzmik@free.fr>2009-04-21 20:33:10 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-23 14:15:31 -0700
commitecf85e481a716cfe07406439fdc7ba9526bbfaeb (patch)
treef74809ac41d451e9fe721723a013db26d40adedc /drivers/usb/otg/otg.c
parent052fbc0d7f76106725c998183d64dcacecd21f8f (diff)
downloadkernel_samsung_smdk4412-ecf85e481a716cfe07406439fdc7ba9526bbfaeb.zip
kernel_samsung_smdk4412-ecf85e481a716cfe07406439fdc7ba9526bbfaeb.tar.gz
kernel_samsung_smdk4412-ecf85e481a716cfe07406439fdc7ba9526bbfaeb.tar.bz2
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>
Diffstat (limited to 'drivers/usb/otg/otg.c')
-rw-r--r--drivers/usb/otg/otg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c
index ff318fa..0a43a7d 100644
--- a/drivers/usb/otg/otg.c
+++ b/drivers/usb/otg/otg.c
@@ -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);