flash: jtagspi: fix clang build warning
commit0e526314a155c73e5eac2dc6bdea0235738ca1a2
authorAntonio Borneo <borneo.antonio@gmail.com>
Sat, 27 May 2023 15:01:58 +0000 (27 17:01 +0200)
committerAntonio Borneo <borneo.antonio@gmail.com>
Fri, 2 Jun 2023 20:58:53 +0000 (2 20:58 +0000)
tree6ea79ff7c29104a57fa3dc8c5a7725f463ae7cb6
parent00603bf15638347256b1c330bafbeaef0d4d8287
flash: jtagspi: fix clang build warning

Clang is unable to fully track the content of the array
write_buffer[] and incorrectly complains that it could contain
some uninitialized value.

To help clang to track the execution flow, rewrite the handling of
the buffer by using simpler indexing and by moving away cmd_byte
from the first buffer's element to the variable cmd_byte.

While there:
- fix the error codes returned while parsing the command line and
- use directly command_print_sameline() instead of passing through
  intermediate buffers.

Change-Id: I1969e896887ea3a4abebee057cc04c03005fa57c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7718
Tested-by: jenkins
src/flash/nor/jtagspi.c