xpp: output of parse_hexbyte() may be negative

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
This commit is contained in:
Tzafrir Cohen
2017-04-02 15:03:26 +03:00
parent 6b119e60f5
commit 8e310fd264

View File

@@ -223,11 +223,12 @@ static int execute_chip_command(xpd_t *xpd, const int argc, char *argv[])
goto out;
}
for (i = 0; i < num_args - 2; i++, argno++) {
input[i] = parse_hexbyte(argv[argno]);
if (input[i] < 0) {
int hexbyte= parse_hexbyte(argv[argno]);
if (hexbyte < 0) {
XPD_ERR(xpd, "Illegal input[%d] number '%s'\n", i, argv[argno]);
goto out;
}
input[i] = hexbyte;
}
ret = xpp_ram_request(xpd->xbus, xpd, portno, writing,
input[0],