> From: Stephen Hemminger <step...@networkplumber.org> > Sent: Saturday, September 9, 2023 10:52 PM > > diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index > > 7630118d4f..a20ca1a988 100644 > > --- a/drivers/net/mana/mana.c > > +++ b/drivers/net/mana/mana.c > > @@ -1260,7 +1260,7 @@ mana_probe_port(struct ibv_device *ibdev, > struct ibv_device_attr_ex *dev_attr, > > /* Create a parent domain with the port number */ > > attr.pd = priv->ib_pd; > > attr.comp_mask = IBV_PARENT_DOMAIN_INIT_ATTR_PD_CONTEXT; > > - attr.pd_context = (void *)(uint64_t)port; > > + attr.pd_context = (void *)(size_t)port; > > Since port is uint8_t, the better cast would be to uintptr_t which is always > an > unsigned value of same size as pointer. > > Also, not sure why using PRIxPTR is necessary; on all arch and platforms %p > should work for printing a pointer and is more common usage.
Thanks Stephen. I will send out a v2 with port casting to uintptr_t. Regarding the use of PRIxPTR, I have seen this in couple other drivers. I think it is probably because the original variable is defined as uintptr_t, which was typedef'ed to unsigned long. We probably want to differentiate it from an actual pointer. And I was trying to stick to original code. Wei