Sfoglia il codice sorgente

Merge branch 'bugfix/fix_i2c_crash_v4.4' into 'release/v4.4'

I2C: Fix I2C Master operation with repeated start condition (backport v4.4)

See merge request espressif/esp-idf!17118
Zim Kalinowski 4 anni fa
parent
commit
81861d03c0
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      components/driver/i2c.c

+ 3 - 1
components/driver/i2c.c

@@ -1342,7 +1342,9 @@ static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num)
             p_i2c->cmd_idx = 0;
             if (i2c_cmd_is_single_byte(cmd) || cmd->total_bytes == cmd->bytes_used) {
                 p_i2c->cmd_link.head = p_i2c->cmd_link.head->next;
-                p_i2c->cmd_link.head->cmd.bytes_used = 0;
+                if(p_i2c->cmd_link.head) {
+                    p_i2c->cmd_link.head->cmd.bytes_used = 0;
+                }
             }
             p_i2c->status = I2C_STATUS_WRITE;
             break;