File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,8 @@ static enum tcpm_state tcpm_default_state(struct tcpm_port *port)
379379 return SNK_UNATTACHED ;
380380 else if (port -> try_role == TYPEC_SOURCE )
381381 return SRC_UNATTACHED ;
382- else if (port -> tcpc -> config -> default_role == TYPEC_SINK )
382+ else if (port -> tcpc -> config &&
383+ port -> tcpc -> config -> default_role == TYPEC_SINK )
383384 return SNK_UNATTACHED ;
384385 /* Fall through to return SRC_UNATTACHED */
385386 } else if (port -> port_type == TYPEC_PORT_SNK ) {
@@ -4114,7 +4115,7 @@ static int tcpm_try_role(const struct typec_capability *cap, int role)
41144115 mutex_lock (& port -> lock );
41154116 if (tcpc -> try_role )
41164117 ret = tcpc -> try_role (tcpc , role );
4117- if (!ret && !tcpc -> config -> try_role_hw )
4118+ if (!ret && ( !tcpc -> config || ! tcpc -> config -> try_role_hw ) )
41184119 port -> try_role = role ;
41194120 port -> try_src_count = 0 ;
41204121 port -> try_snk_count = 0 ;
@@ -4701,7 +4702,7 @@ static int tcpm_copy_caps(struct tcpm_port *port,
47014702 port -> typec_caps .prefer_role = tcfg -> default_role ;
47024703 port -> typec_caps .type = tcfg -> type ;
47034704 port -> typec_caps .data = tcfg -> data ;
4704- port -> self_powered = port -> tcpc -> config -> self_powered ;
4705+ port -> self_powered = tcfg -> self_powered ;
47054706
47064707 return 0 ;
47074708}
You can’t perform that action at this time.
0 commit comments