Commit 94865e2d authored by Guenter Roeck's avatar Guenter Roeck Committed by Greg Kroah-Hartman

habanalabs: Fix test build failures

allmodconfig builds on 32-bit architectures fail with the following error.

drivers/misc/habanalabs/common/memory.c: In function 'alloc_device_memory':
drivers/misc/habanalabs/common/memory.c:153:49: error:
	cast from pointer to integer of different size

Fix the typecast. While at it, drop other unnecessary typecasts associated
with the same commit.

Fixes: e8458e20 ("habanalabs: make sure device mem alloc is page aligned")
Cc: Ohad Sharabi <osharabi@habana.ai>
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20220404134859.3278599-1-linux@roeck-us.netSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 31231092
...@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, ...@@ -111,10 +111,10 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
if (contiguous) { if (contiguous) {
if (is_power_of_2(page_size)) if (is_power_of_2(page_size))
paddr = (u64) (uintptr_t) gen_pool_dma_alloc_align(vm->dram_pg_pool, paddr = (uintptr_t) gen_pool_dma_alloc_align(vm->dram_pg_pool,
total_size, NULL, page_size); total_size, NULL, page_size);
else else
paddr = (u64) (uintptr_t) gen_pool_alloc(vm->dram_pg_pool, total_size); paddr = gen_pool_alloc(vm->dram_pg_pool, total_size);
if (!paddr) { if (!paddr) {
dev_err(hdev->dev, dev_err(hdev->dev,
"failed to allocate %llu contiguous pages with total size of %llu\n", "failed to allocate %llu contiguous pages with total size of %llu\n",
...@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args, ...@@ -150,12 +150,12 @@ static int alloc_device_memory(struct hl_ctx *ctx, struct hl_mem_in *args,
for (i = 0 ; i < num_pgs ; i++) { for (i = 0 ; i < num_pgs ; i++) {
if (is_power_of_2(page_size)) if (is_power_of_2(page_size))
phys_pg_pack->pages[i] = phys_pg_pack->pages[i] =
(u64) gen_pool_dma_alloc_align(vm->dram_pg_pool, (uintptr_t)gen_pool_dma_alloc_align(vm->dram_pg_pool,
page_size, NULL, page_size, NULL,
page_size); page_size);
else else
phys_pg_pack->pages[i] = (u64) gen_pool_alloc(vm->dram_pg_pool, phys_pg_pack->pages[i] = gen_pool_alloc(vm->dram_pg_pool,
page_size); page_size);
if (!phys_pg_pack->pages[i]) { if (!phys_pg_pack->pages[i]) {
dev_err(hdev->dev, dev_err(hdev->dev,
"Failed to allocate device memory (out of memory)\n"); "Failed to allocate device memory (out of memory)\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment