diff options
Diffstat (limited to 'src/flash/nor/tcl.c')
-rw-r--r-- | src/flash/nor/tcl.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 57c3be5..788d050 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -101,12 +101,13 @@ COMMAND_HANDLER(handle_flash_info_command) protect_state); } - *buf = '\0'; /* initialize buffer, otherwise it migh contain garbage if driver - *function fails */ - retval = p->driver->info(p, buf, sizeof(buf)); - command_print(CMD_CTX, "%s", buf); - if (retval != ERROR_OK) - LOG_ERROR("error retrieving flash info"); + if (p->driver->info != NULL) { + retval = p->driver->info(p, buf, sizeof(buf)); + if (retval == ERROR_OK) + command_print(CMD_CTX, "%s", buf); + else + LOG_ERROR("error retrieving flash info"); + } } return retval; |