usb: musb: mediatek: don't unregister something that wasn't registered

[ Upstream commit ba883de971 ]

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: 0990366bab ("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>
This commit is contained in:
Dan Carpenter 2023-01-24 18:20:46 +03:00 коммит произвёл Greg Kroah-Hartman
Родитель 2aff0632ac
Коммит f12829e513
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -346,7 +346,8 @@ static int mtk_musb_init(struct musb *musb)
err_phy_power_on:
phy_exit(glue->phy);
err_phy_init:
mtk_otg_switch_exit(glue);
if (musb->port_mode == MUSB_OTG)
mtk_otg_switch_exit(glue);
return ret;
}