> +static void > +cd321x_unregister_port(struct tps6598x *tps) > +{ > + struct cd321x *cd321x = container_of(tps, struct cd321x, tps); > + > + if (cd321x->port_altmode_dp) > + typec_unregister_altmode(cd321x->port_altmode_dp); > + if (cd321x->port_altmode_tbt) > + typec_unregister_altmode(cd321x->port_altmode_tbt); You can call typec_unregister_altmode() unconditionally here - it's NULL safe. thanks, > + cd321x->port_altmode_dp = NULL; > + cd321x->port_altmode_tbt = NULL; > + typec_unregister_port(tps->port); > +} -- heikki