Browse Source

cmd_spi: remove broken signed casting for display

Since we're working with unsigned data, you can't apply a signed pointer
cast and then attempt to print the result.  Otherwise you get wrong output
when the sign bit is set like "0xFF" incorrectly extended to "0xFFFFFFFF".

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Mike Frysinger 16 years ago
parent
commit
c46980f6d2
1 changed files with 1 additions and 2 deletions
  1. 1 2
      common/cmd_spi.c

+ 1 - 2
common/cmd_spi.c

@@ -123,9 +123,8 @@ int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		printf("Error with the SPI transaction.\n");
 		rcode = 1;
 	} else {
-		cp = (char *)din;
 		for(j = 0; j < ((bitlen + 7) / 8); j++) {
-			printf("%02X", *cp++);
+			printf("%02X", din[j]);
 		}
 		printf("\n");
 	}