Re: git: e602a30bb9fc - main - irdma(4): Fix compile error on powerpc64

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Wed, 25 May 2022 02:01:31 UTC
On 25 May 2022, at 01:30, Eric Joyner <erj@FreeBSD.org> wrote:
> 
> The branch main has been updated by erj:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=e602a30bb9fc7ee041a0e629d0fd2db7933ffa32
> 
> commit e602a30bb9fc7ee041a0e629d0fd2db7933ffa32
> Author:     Eric Joyner <erj@FreeBSD.org>
> AuthorDate: 2022-05-25 00:27:29 +0000
> Commit:     Eric Joyner <erj@FreeBSD.org>
> CommitDate: 2022-05-25 00:30:46 +0000
> 
>    irdma(4): Fix compile error on powerpc64
> 
>    Jenkins reports that the type used in a printf() specifier is
>    incorrect, so fix it in order to use the appropriate type.
> 
>    Signed-off-by: Eric Joyner <erj@FreeBSD.org>
> 
>    Reported by:    Jenkins CI
>    MFC after:      6 days
>    MFC-with:       cdcd52d41e246ba1c0fcfad0769bd691487355ef
>    Sponsored by:   Intel Corporation
> ---
> sys/dev/irdma/icrdma.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sys/dev/irdma/icrdma.c b/sys/dev/irdma/icrdma.c
> index 7cf441b37648..6867274d1cb8 100644
> --- a/sys/dev/irdma/icrdma.c
> +++ b/sys/dev/irdma/icrdma.c
> @@ -499,7 +499,7 @@ irdma_probe(struct ice_rdma_peer *peer)
> 	struct irdma_handler *hdl;
> 	int err = 0;
> 
> -	irdma_pr_info("probe: irdma-%s peer=%p, peer->pf_id=%d, peer->ifp=%p, peer->ifp->if_dunit=%d, peer->pci_mem->r_bustag=%lx\n",
> +	irdma_pr_info("probe: irdma-%s peer=%p, peer->pf_id=%d, peer->ifp=%p, peer->ifp->if_dunit=%d, peer->pci_mem->r_bustag=%p\n",
> 		      irdma_driver_version, peer, peer->pf_id, peer->ifp,
> 		      pf_if_d(peer), peer->pci_mem->r_bustag);

It’s an int on i386, a uint64_t on amd64 and a struct bus_space * on
all other architectures, so this just trades breaking non-x86 for
breaking x86. You probably want something like

  (void *)(uintptr_t)peer->pci_mem->r_bustag

as something that’ll work everywhere, that or take it the other
direction and forcefully cast it down to an integer type and print that
like

  (uintmax_t)(uintptr_t)peer->pci_mem->r_bustag

with %jx or just

  (uintptr_t)peer->pci_mem->r_bustag

with PRIxPTR, but we rarely use those macros.

Jess