Skip to content

Commit 54c4b0c

Browse files
authored
Fix RMT mutex unlock using incorrect channel number in rmtDeinit (#10034)
1 parent 6bd3274 commit 54c4b0c

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎cores/esp32/esp32-hal-rmt.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,22 +325,23 @@ bool rmtDeinit(rmt_obj_t *rmt)
325325
return false;
326326
}
327327

328-
RMT_MUTEX_LOCK(rmt->channel);
328+
intchannel=rmt->channel;
329+
RMT_MUTEX_LOCK(channel);
329330
// force stopping rmt processing
330331
if (rmt->tx_not_rx){
331-
rmt_tx_stop(rmt->channel);
332+
rmt_tx_stop(channel);
332333
} else{
333-
rmt_rx_stop(rmt->channel);
334+
rmt_rx_stop(channel);
334335
if(rmt->rxTaskHandle){
335336
vTaskDelete(rmt->rxTaskHandle);
336337
rmt->rxTaskHandle=NULL;
337338
}
338339
}
339340

340-
rmt_driver_uninstall(rmt->channel);
341+
rmt_driver_uninstall(channel);
341342

342-
size_tfrom=rmt->channel;
343-
size_tto=rmt->buffers+rmt->channel;
343+
size_tfrom=channel;
344+
size_tto=rmt->buffers+channel;
344345
size_ti;
345346

346347
for (i=from; i<to; i++){
@@ -349,7 +350,7 @@ bool rmtDeinit(rmt_obj_t *rmt)
349350

350351
g_rmt_objects[from].channel=0;
351352
g_rmt_objects[from].buffers=0;
352-
RMT_MUTEX_UNLOCK(rmt->channel);
353+
RMT_MUTEX_UNLOCK(channel);
353354

354355
#if !CONFIG_DISABLE_HAL_LOCKS
355356
if(g_rmt_objlocks[from] !=NULL){

0 commit comments

Comments
(0)