usb: musb: mediatek: don't unregister something that wasn't registered
authorDan Carpenter <error27@gmail.com>
Tue, 24 Jan 2023 15:20:46 +0000 (18:20 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:35 +0000 (09:33 +0100)
commit8c2059513e5490dedf450524d2da2f3f1681a1e1
treeb9feabc917dff9dfc6030685ee971115c348f1de
parenta661cccff0592604bef00e25083a49442516010d
usb: musb: mediatek: don't unregister something that wasn't registered

[ Upstream commit ba883de971d1ad018f3083d9195b8abe54d87407 ]

This function only calls mtk_otg_switch_init() when the ->port_mode
is MUSB_OTG so the clean up code should only call mtk_otg_switch_exit()
for that mode.

Fixes: 0990366bab3c ("usb: musb: Add support for MediaTek musb controller")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/Y8/3TqpqiSr0RxFH@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/musb/mediatek.c