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)
379
379
return SNK_UNATTACHED ;
380
380
else if (port -> try_role == TYPEC_SOURCE )
381
381
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 )
383
384
return SNK_UNATTACHED ;
384
385
/* Fall through to return SRC_UNATTACHED */
385
386
} else if (port -> port_type == TYPEC_PORT_SNK ) {
@@ -4114,7 +4115,7 @@ static int tcpm_try_role(const struct typec_capability *cap, int role)
4114
4115
mutex_lock (& port -> lock );
4115
4116
if (tcpc -> try_role )
4116
4117
ret = tcpc -> try_role (tcpc , role );
4117
- if (!ret && !tcpc -> config -> try_role_hw )
4118
+ if (!ret && ( !tcpc -> config || ! tcpc -> config -> try_role_hw ) )
4118
4119
port -> try_role = role ;
4119
4120
port -> try_src_count = 0 ;
4120
4121
port -> try_snk_count = 0 ;
@@ -4701,7 +4702,7 @@ static int tcpm_copy_caps(struct tcpm_port *port,
4701
4702
port -> typec_caps .prefer_role = tcfg -> default_role ;
4702
4703
port -> typec_caps .type = tcfg -> type ;
4703
4704
port -> typec_caps .data = tcfg -> data ;
4704
- port -> self_powered = port -> tcpc -> config -> self_powered ;
4705
+ port -> self_powered = tcfg -> self_powered ;
4705
4706
4706
4707
return 0 ;
4707
4708
}
You can’t perform that action at this time.
0 commit comments