diff mbox

[U-Boot,08/10] scsi: Use correct printf() format string for uintptr_t

Message ID 1413369519-11677-9-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass Oct. 15, 2014, 10:38 a.m. UTC
Use the inttypes header file to provide this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/cmd_scsi.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Tom Rini Oct. 27, 2014, 10:20 p.m. UTC | #1
On Wed, Oct 15, 2014 at 04:38:37AM -0600, Simon Glass wrote:

> Use the inttypes header file to provide this.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!
Masahiro Yamada Dec. 15, 2014, 6:32 p.m. UTC | #2
2014-10-15 19:38 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Use the inttypes header file to provide this.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  common/cmd_scsi.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
> index b3f7687..cbc107e 100644
> --- a/common/cmd_scsi.c
> +++ b/common/cmd_scsi.c
> @@ -10,6 +10,7 @@
>   */
>  #include <common.h>
>  #include <command.h>
> +#include <inttypes.h>
>  #include <asm/processor.h>
>  #include <scsi.h>
>  #include <image.h>
> @@ -391,7 +392,7 @@ static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
>                         blks=0;
>                 }
>                 debug("scsi_read_ext: startblk " LBAF
> -                     ", blccnt %x buffer %lx\n",
> +                     ", blccnt %x buffer %" PRIXPTR "\n",
>                       start, smallblks, buf_addr);


The root cause of the problem is to use uintptr_t provided by
the compiler.

"unsigned long" can store a pointer whether it is 32bit or 64bit system.
(I have never seen LLP64 on Unix-like 64bit system.)
diff mbox

Patch

diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index b3f7687..cbc107e 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -10,6 +10,7 @@ 
  */
 #include <common.h>
 #include <command.h>
+#include <inttypes.h>
 #include <asm/processor.h>
 #include <scsi.h>
 #include <image.h>
@@ -391,7 +392,7 @@  static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
 			blks=0;
 		}
 		debug("scsi_read_ext: startblk " LBAF
-		      ", blccnt %x buffer %lx\n",
+		      ", blccnt %x buffer %" PRIXPTR "\n",
 		      start, smallblks, buf_addr);
 		if (scsi_exec(pccb) != true) {
 			scsi_print_error(pccb);
@@ -401,7 +402,7 @@  static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
 		buf_addr+=pccb->datalen;
 	} while(blks!=0);
 	debug("scsi_read_ext: end startblk " LBAF
-	      ", blccnt %x buffer %lx\n", start, smallblks, buf_addr);
+	      ", blccnt %x buffer %" PRIXPTR "\n", start, smallblks, buf_addr);
 	return(blkcnt);
 }
 
@@ -445,7 +446,7 @@  static ulong scsi_write(int device, lbaint_t blknr,
 			start += blks;
 			blks = 0;
 		}
-		debug("%s: startblk " LBAF ", blccnt %x buffer %lx\n",
+		debug("%s: startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n",
 		      __func__, start, smallblks, buf_addr);
 		if (scsi_exec(pccb) != true) {
 			scsi_print_error(pccb);
@@ -454,7 +455,7 @@  static ulong scsi_write(int device, lbaint_t blknr,
 		}
 		buf_addr += pccb->datalen;
 	} while (blks != 0);
-	debug("%s: end startblk " LBAF ", blccnt %x buffer %lx\n",
+	debug("%s: end startblk " LBAF ", blccnt %x buffer %" PRIXPTR "\n",
 	      __func__, start, smallblks, buf_addr);
 	return blkcnt;
 }