From: Robert Jarzmik Date: Wed, 22 Apr 2009 03:33:10 +0000 (-0700) Subject: USB: otg: Fix bug on remove path without transceiver X-Git-Tag: 2.1b_release~12839^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ecf85e481a716cfe07406439fdc7ba9526bbfaeb;p=platform%2Fkernel%2Fkernel-mfld-blackbay.git 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 Acked-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- 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);