mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 20:21:04 +00:00
coverity: fix uninit variable issue in driver
Related CID: 389832, 389838, 389880, 286743, 286752, 395156, 291011, 396001, 396002
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "esp_gdbstub_common.h"
|
||||
|
||||
// GDB command input buffer
|
||||
@@ -45,6 +46,8 @@ void esp_gdbstub_send_str(const char *c)
|
||||
// 'bits'/4 dictates the number of hex chars sent.
|
||||
void esp_gdbstub_send_hex(int val, int bits)
|
||||
{
|
||||
// sanity check, in case the following (i - 4) is a negative value
|
||||
assert(bits >= 4);
|
||||
const char *hex_chars = "0123456789abcdef";
|
||||
for (int i = bits; i > 0; i -= 4) {
|
||||
esp_gdbstub_send_char(hex_chars[(val >> (i - 4)) & 0xf]);
|
||||
|
Reference in New Issue
Block a user