diff --git a/linux_mtd.c b/linux_mtd.c index 22702e904..316c8eddf 100644 --- a/linux_mtd.c +++ b/linux_mtd.c @@ -280,9 +280,11 @@ static int linux_mtd_erase(struct flashctx *flash, .length = mtd_erasesize, }; - if (ioctl(fileno(dev_fp), MEMERASE, &erase_info) == -1) { - msg_perr("%s: ioctl: %s\n", __func__, strerror(errno)); - return 1; + int ret = ioctl(fileno(dev_fp), MEMERASE, &erase_info); + if (ret < 0) { + msg_perr("%s: MEMERASE ioctl call returned %d, error: %s\n", + __func__, ret, strerror(errno)); + return 1; } }