usb: ci13xxx_udc: Set OTG's peripheral to NULL in udc_remove

If msm_otg_probe fails after registering the peripheral driver,
then we go for unregistering the gadget via udc_remove. But we
still set the OTG's peripheral as the previous gadget pointer the
elements of which have been cleared. Then when we try to start
peripheral mode, it leads to NULL pointer dereference when the
gadget ops are accessed.

Fix this by setting OTG's peripheral to NULL, thus bailing out if
we try to start peripheral mode.

Change-Id: Ib1a90ecd1342a7df57270298906b689d088f3e8a
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
1 file changed