]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cmd_spi: remove broken signed casting for display
authorMike Frysinger <vapier@gentoo.org>
Tue, 14 Oct 2008 11:04:38 +0000 (07:04 -0400)
committerWolfgang Denk <wd@denx.de>
Tue, 14 Oct 2008 12:19:34 +0000 (14:19 +0200)
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>
common/cmd_spi.c

index 40ee7e7dd3c7daa08270fbfc72d0d7967d92077c..1f0727b4a24ff8384c0af4839aaef5cdcb98fe1b 100644 (file)
@@ -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");
        }