hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/usb/chipidea/otg.c
....@@ -166,8 +166,10 @@
166166
167167 static void ci_handle_id_switch(struct ci_hdrc *ci)
168168 {
169
- enum ci_role role = ci_otg_role(ci);
169
+ enum ci_role role;
170170
171
+ mutex_lock(&ci->mutex);
172
+ role = ci_otg_role(ci);
171173 if (role != ci->role) {
172174 dev_dbg(ci->dev, "switching from %s to %s\n",
173175 ci_role(ci)->name, ci->roles[role]->name);
....@@ -197,6 +199,7 @@
197199 if (role == CI_ROLE_GADGET)
198200 ci_handle_vbus_change(ci);
199201 }
202
+ mutex_unlock(&ci->mutex);
200203 }
201204 /**
202205 * ci_otg_work - perform otg (vbus/id) event handle