diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c index e84b134a33813..2624bc27a9464 100644 --- a/drivers/usb/typec/bus.c +++ b/drivers/usb/typec/bus.c @@ -535,10 +535,19 @@ static int typec_probe(struct device *dev) } ret = drv->probe(adev); - if (ret) + if (ret) { typec_altmode_remove_links(altmode); + return ret; + } + + /* + * A mode entered before its driver bound took no reference on the + * driver's module, but leaving it drops one. Take it now. + */ + if (adev->active && !is_typec_port(adev->dev.parent)) + WARN_ON(!try_module_get(drv->driver.owner)); - return ret; + return 0; } static void typec_remove(struct device *dev)