public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: amso1100: fix format string for 64-bit phys_addr
@ 2016-02-01 16:34 Arnd Bergmann
  2016-02-04 12:15 ` Doug Ledford
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-02-01 16:34 UTC (permalink / raw)
  To: Doug Ledford, Sean Hefty, Hal Rosenstock
  Cc: Greg Kroah-Hartman, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

The amso1100 driver prints a phys_addr_t by casting it to a pointer,
which causes a warning when phys_addr_t is 64-bit and pointers
are 32-bit:

drivers/staging/rdma/amso1100/c2.c: In function 'c2_rx_error':
drivers/staging/rdma/amso1100/c2.c:430:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

This changes the format string to print the address as a 64-bit
number all the time to avoids the warnings. Ideally we would use
the %pap format string for phys_addr_t, but that doesn't work
here easily as it requires passing a pointer to the address.

Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
Found on ARM randconfig testing. This must have been there forever but is
rather hard to trigger even with randconfig builds.

diff --git a/drivers/staging/rdma/amso1100/c2.c b/drivers/staging/rdma/amso1100/c2.c
index b46ebd1ae15a..170a42a60552 100644
--- a/drivers/staging/rdma/amso1100/c2.c
+++ b/drivers/staging/rdma/amso1100/c2.c
@@ -426,8 +426,8 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem)
 		pr_debug("    index : %Zu\n",
 			elem - c2_port->rx_ring.start);
 		pr_debug("    len   : %u\n", rx_desc->len);
-		pr_debug("  rxp_hdr : %p [PA %p]\n", rxp_hdr,
-			(void *) __pa((unsigned long) rxp_hdr));
+		pr_debug("  rxp_hdr : %p [PA %016llx\n", rxp_hdr,
+			(u64)__pa((unsigned long) rxp_hdr));
 		pr_debug("    flags : 0x%x\n", rxp_hdr->flags);
 		pr_debug("    status: 0x%x\n", rxp_hdr->status);
 		pr_debug("    len   : %u\n", rxp_hdr->len);

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: amso1100: fix format string for 64-bit phys_addr
  2016-02-01 16:34 [PATCH] staging: amso1100: fix format string for 64-bit phys_addr Arnd Bergmann
@ 2016-02-04 12:15 ` Doug Ledford
  2016-02-04 13:07   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Doug Ledford @ 2016-02-04 12:15 UTC (permalink / raw)
  To: Arnd Bergmann, Sean Hefty, Hal Rosenstock
  Cc: linux-rdma, Greg Kroah-Hartman, devel, linux-kernel,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1809 bytes --]

On 02/01/2016 11:34 AM, Arnd Bergmann wrote:
> The amso1100 driver prints a phys_addr_t by casting it to a pointer,
> which causes a warning when phys_addr_t is 64-bit and pointers
> are 32-bit:
> 
> drivers/staging/rdma/amso1100/c2.c: In function 'c2_rx_error':
> drivers/staging/rdma/amso1100/c2.c:430:4: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
> 
> This changes the format string to print the address as a 64-bit
> number all the time to avoids the warnings. Ideally we would use
> the %pap format string for phys_addr_t, but that doesn't work
> here easily as it requires passing a pointer to the address.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> Found on ARM randconfig testing. This must have been there forever but is
> rather hard to trigger even with randconfig builds.
> 
> diff --git a/drivers/staging/rdma/amso1100/c2.c b/drivers/staging/rdma/amso1100/c2.c
> index b46ebd1ae15a..170a42a60552 100644
> --- a/drivers/staging/rdma/amso1100/c2.c
> +++ b/drivers/staging/rdma/amso1100/c2.c
> @@ -426,8 +426,8 @@ static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem)
>  		pr_debug("    index : %Zu\n",
>  			elem - c2_port->rx_ring.start);
>  		pr_debug("    len   : %u\n", rx_desc->len);
> -		pr_debug("  rxp_hdr : %p [PA %p]\n", rxp_hdr,
> -			(void *) __pa((unsigned long) rxp_hdr));
> +		pr_debug("  rxp_hdr : %p [PA %016llx\n", rxp_hdr,
> +			(u64)__pa((unsigned long) rxp_hdr));
>  		pr_debug("    flags : 0x%x\n", rxp_hdr->flags);
>  		pr_debug("    status: 0x%x\n", rxp_hdr->status);
>  		pr_debug("    len   : %u\n", rxp_hdr->len);
> 

I've sent off a deletion of this file to Linus already, sorry.

-- 
Doug Ledford <dledford@redhat.com>
              GPG KeyID: 0E572FDD



[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: amso1100: fix format string for 64-bit phys_addr
  2016-02-04 12:15 ` Doug Ledford
@ 2016-02-04 13:07   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-02-04 13:07 UTC (permalink / raw)
  To: Doug Ledford
  Cc: Sean Hefty, Hal Rosenstock, Greg Kroah-Hartman, linux-rdma, devel,
	linux-kernel, linux-arm-kernel

On Thursday 04 February 2016 07:15:05 Doug Ledford wrote:
> I've sent off a deletion of this file to Linus already, sorry.
> 

Even better, thanks!

	Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-04 13:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-01 16:34 [PATCH] staging: amso1100: fix format string for 64-bit phys_addr Arnd Bergmann
2016-02-04 12:15 ` Doug Ledford
2016-02-04 13:07   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox