As the typec switch provider driver's dev may not the parent of typec_switch dev(may be the switch's parent's parent), but we use the typec switch provider driver dev's fwnode anyway, so change to use fwnode's dev to get driver's user count. Signed-off-by: Li Jun <jun.li@xxxxxxx> --- New patch for v6. drivers/usb/typec/mux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/mux.c b/drivers/usb/typec/mux.c index 3da17d1..0219aa4 100644 --- a/drivers/usb/typec/mux.c +++ b/drivers/usb/typec/mux.c @@ -65,7 +65,7 @@ struct typec_switch *fwnode_typec_switch_get(struct fwnode_handle *fwnode) sw = fwnode_connection_find_match(fwnode, "typec-orientation-switch", NULL, typec_switch_match); if (!IS_ERR_OR_NULL(sw)) - WARN_ON(!try_module_get(sw->dev.parent->driver->owner)); + WARN_ON(!try_module_get(dev_fwnode(&sw->dev)->dev->driver->owner)); return sw; } @@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(fwnode_typec_switch_get); void typec_switch_put(struct typec_switch *sw) { if (!IS_ERR_OR_NULL(sw)) { - module_put(sw->dev.parent->driver->owner); + module_put(dev_fwnode(&sw->dev)->dev->driver->owner); put_device(&sw->dev); } } -- 2.7.4