@@ -75,27 +75,33 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port,
75
75
struct fwnode_handle * fwnode ,
76
76
struct device * dev )
77
77
{
78
+ int ret = 0 ;
79
+
78
80
port -> mux = fwnode_typec_mux_get (fwnode , NULL );
79
81
if (IS_ERR (port -> mux )) {
80
- dev_dbg (dev , "Mux handle not found.\n" );
82
+ ret = PTR_ERR (port -> mux );
83
+ dev_dbg (dev , "Mux handle not found: %d.\n" , ret );
81
84
goto mux_err ;
82
85
}
83
86
84
87
port -> retimer = fwnode_typec_retimer_get (fwnode );
85
88
if (IS_ERR (port -> retimer )) {
86
- dev_dbg (dev , "Retimer handle not found.\n" );
89
+ ret = PTR_ERR (port -> retimer );
90
+ dev_dbg (dev , "Retimer handle not found: %d.\n" , ret );
87
91
goto retimer_sw_err ;
88
92
}
89
93
90
94
port -> ori_sw = fwnode_typec_switch_get (fwnode );
91
95
if (IS_ERR (port -> ori_sw )) {
92
- dev_dbg (dev , "Orientation switch handle not found.\n" );
96
+ ret = PTR_ERR (port -> ori_sw );
97
+ dev_dbg (dev , "Orientation switch handle not found: %d\n" , ret );
93
98
goto ori_sw_err ;
94
99
}
95
100
96
101
port -> role_sw = fwnode_usb_role_switch_get (fwnode );
97
102
if (IS_ERR (port -> role_sw )) {
98
- dev_dbg (dev , "USB role switch handle not found.\n" );
103
+ ret = PTR_ERR (port -> role_sw );
104
+ dev_dbg (dev , "USB role switch handle not found: %d\n" , ret );
99
105
goto role_sw_err ;
100
106
}
101
107
@@ -111,7 +117,7 @@ static int cros_typec_get_switch_handles(struct cros_typec_port *port,
111
117
typec_mux_put (port -> mux );
112
118
port -> mux = NULL ;
113
119
mux_err :
114
- return - ENODEV ;
120
+ return ret ;
115
121
}
116
122
117
123
static int cros_typec_add_partner (struct cros_typec_data * typec , int port_num ,
@@ -359,9 +365,11 @@ static int cros_typec_init_ports(struct cros_typec_data *typec)
359
365
}
360
366
361
367
ret = cros_typec_get_switch_handles (cros_port , fwnode , dev );
362
- if (ret )
363
- dev_dbg (dev , "No switch control for port %d\n" ,
364
- port_num );
368
+ if (ret ) {
369
+ dev_dbg (dev , "No switch control for port %d, err: %d\n" , port_num , ret );
370
+ if (ret == - EPROBE_DEFER )
371
+ goto unregister_ports ;
372
+ }
365
373
366
374
ret = cros_typec_register_port_altmodes (typec , port_num );
367
375
if (ret ) {
0 commit comments