|
38 | 38 |
|
39 | 39 | void ucsi_notify_common(struct ucsi *ucsi, u32 cci) |
40 | 40 | { |
| 41 | + /* Ignore bogus data in CCI if busy indicator is set. */ |
| 42 | + if (cci & UCSI_CCI_BUSY) |
| 43 | + return; |
| 44 | + |
41 | 45 | if (UCSI_CCI_CONNECTOR(cci)) |
42 | 46 | ucsi_connector_change(ucsi, UCSI_CCI_CONNECTOR(cci)); |
43 | 47 |
|
@@ -103,15 +107,13 @@ static int ucsi_run_command(struct ucsi *ucsi, u64 command, u32 *cci, |
103 | 107 | return -EINVAL; |
104 | 108 |
|
105 | 109 | ret = ucsi->ops->sync_control(ucsi, command); |
106 | | - if (ret) |
107 | | - return ret; |
108 | | - |
109 | | - ret = ucsi->ops->read_cci(ucsi, cci); |
110 | | - if (ret) |
111 | | - return ret; |
| 110 | + if (ucsi->ops->read_cci(ucsi, cci)) |
| 111 | + return -EIO; |
112 | 112 |
|
113 | 113 | if (*cci & UCSI_CCI_BUSY) |
114 | 114 | return ucsi_run_command(ucsi, UCSI_CANCEL, cci, NULL, 0, false) ?: -EBUSY; |
| 115 | + if (ret) |
| 116 | + return ret; |
115 | 117 |
|
116 | 118 | if (!(*cci & UCSI_CCI_COMMAND_COMPLETE)) |
117 | 119 | return -EIO; |
@@ -1197,6 +1199,10 @@ static void ucsi_handle_connector_change(struct work_struct *work) |
1197 | 1199 |
|
1198 | 1200 | mutex_lock(&con->lock); |
1199 | 1201 |
|
| 1202 | + if (!test_and_set_bit(EVENT_PENDING, &ucsi->flags)) |
| 1203 | + dev_err_once(ucsi->dev, "%s entered without EVENT_PENDING\n", |
| 1204 | + __func__); |
| 1205 | + |
1200 | 1206 | command = UCSI_GET_CONNECTOR_STATUS | UCSI_CONNECTOR_NUMBER(con->num); |
1201 | 1207 |
|
1202 | 1208 | ret = ucsi_send_command_common(ucsi, command, &con->status, |
|
0 commit comments