diff options
-rw-r--r-- | stlinkv3_spi.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/stlinkv3_spi.c b/stlinkv3_spi.c index 9e621c27..114c0cab 100644 --- a/stlinkv3_spi.c +++ b/stlinkv3_spi.c @@ -491,10 +491,11 @@ int stlinkv3_spi_init(void) speed_str = extract_programmer_param("spispeed"); if (speed_str) { sck_freq_kHz = strtoul(speed_str, &endptr, 0); - if (*endptr) { + if (*endptr || sck_freq_kHz == 0) { msg_perr("The spispeed parameter passed with invalid format: %s\n", speed_str); - msg_perr("Please pass the parameter with a simple number in kHz\n"); + msg_perr("Please pass the parameter " + "with a simple non-zero number in kHz\n"); free(speed_str); return -1; } |