summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/irdma/utils.c
diff options
context:
space:
mode:
authorShiraz Saleem <shiraz.saleem@intel.com>2021-06-09 18:49:24 -0500
committerJason Gunthorpe <jgg@nvidia.com>2021-06-10 09:39:27 -0300
commit2db7b2eac7ad55105fe037b3f8f57d8ecac8c3fb (patch)
tree6fd50ad9ad1e768e49f08b56fcc9a36d549cfc8e /drivers/infiniband/hw/irdma/utils.c
parentbf0480a2df7597b43a8383191e14580243ecc1f9 (diff)
RDMA/irdma: Store PBL info address a pointer type
The level1 PBL info address is stored as u64. This requires casting through a uinptr_t before used as a pointer type. And this leads to sparse warning such as this when uinptr_t is missing: drivers/infiniband/hw/irdma/hw.c: In function 'irdma_destroy_virt_aeq': drivers/infiniband/hw/irdma/hw.c:579:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 579 | dma_addr_t *pg_arr = (dma_addr_t *)aeq->palloc.level1.addr; This can be fixed using an intermediate uintptr_t, but rather it is better to fix the structure irdm_pble_info to store the address as u64* and the VA it is assigned in irdma_chunk as a void*. This greatly reduces the casting on this address. Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitions") Link: https://lore.kernel.org/r/20210609234924.938-1-shiraz.saleem@intel.com Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/hw/irdma/utils.c')
-rw-r--r--drivers/infiniband/hw/irdma/utils.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
index b4b91cb81cca..ea1df5918c11 100644
--- a/drivers/infiniband/hw/irdma/utils.c
+++ b/drivers/infiniband/hw/irdma/utils.c
@@ -2315,7 +2315,7 @@ enum irdma_status_code irdma_prm_add_pble_mem(struct irdma_pble_prm *pprm,
enum irdma_status_code
irdma_prm_get_pbles(struct irdma_pble_prm *pprm,
struct irdma_pble_chunkinfo *chunkinfo, u32 mem_size,
- u64 *vaddr, u64 *fpm_addr)
+ u64 **vaddr, u64 *fpm_addr)
{
u64 bits_needed;
u64 bit_idx = PBLE_INVALID_IDX;
@@ -2323,7 +2323,7 @@ irdma_prm_get_pbles(struct irdma_pble_prm *pprm,
struct list_head *chunk_entry = pprm->clist.next;
u32 offset;
unsigned long flags;
- *vaddr = 0;
+ *vaddr = NULL;
*fpm_addr = 0;
bits_needed = (mem_size + (1 << pprm->pble_shift) - 1) >> pprm->pble_shift;
@@ -2429,8 +2429,8 @@ void irdma_pble_free_paged_mem(struct irdma_chunk *chunk)
done:
kfree(chunk->dmainfo.dmaaddrs);
chunk->dmainfo.dmaaddrs = NULL;
- vfree((void *)(uintptr_t)chunk->vaddr);
- chunk->vaddr = 0;
+ vfree(chunk->vaddr);
+ chunk->vaddr = NULL;
chunk->type = 0;
}
@@ -2459,7 +2459,7 @@ enum irdma_status_code irdma_pble_get_paged_mem(struct irdma_chunk *chunk,
vfree(va);
goto err;
}
- chunk->vaddr = (uintptr_t)va;
+ chunk->vaddr = va;
chunk->size = size;
chunk->pg_cnt = pg_cnt;
chunk->type = PBLE_SD_PAGED;