From 0701ac54fc1d16f545839cd6c7b5f26d9ac139c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20S=C3=A1?= Date: Mon, 4 Aug 2025 14:04:16 +0100 Subject: [PATCH] misc: mathworks: fix some -Wint-to-pointer-cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some 32bits architectures (like those in RPIs) support LPAE (Large Physical Address Extension) which means phys_addr_t will be of 'u64' type. Therefore we can have some int-to-pointer-cast warnings if not properly casting (in calls like virt_to_page()). Hence, first cast to uintptr_t before doing (void *). Signed-off-by: Nuno Sá --- drivers/misc/mathworks/mathworks_ip_common.c | 2 +- drivers/misc/mathworks/mw_stream_channel.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/mathworks/mathworks_ip_common.c b/drivers/misc/mathworks/mathworks_ip_common.c index dfb7b1387780ff..459053a7954a95 100644 --- a/drivers/misc/mathworks/mathworks_ip_common.c +++ b/drivers/misc/mathworks/mathworks_ip_common.c @@ -231,7 +231,7 @@ static vm_fault_t mathworks_ip_mmap_fault(struct vm_fault *vmf) struct page *thisPage; unsigned long offset; offset = (vmf->pgoff - vma->vm_pgoff) << PAGE_SHIFT; - thisPage = virt_to_page((void *)(thisIpcore->mem->start + offset)); + thisPage = virt_to_page((void *)(uintptr_t)(thisIpcore->mem->start + offset)); get_page(thisPage); vmf->page = thisPage; return 0; diff --git a/drivers/misc/mathworks/mw_stream_channel.c b/drivers/misc/mathworks/mw_stream_channel.c index fb348faf887dc9..c611519c2deb12 100644 --- a/drivers/misc/mathworks/mw_stream_channel.c +++ b/drivers/misc/mathworks/mw_stream_channel.c @@ -773,7 +773,7 @@ static vm_fault_t mwadma_mmap_fault(struct vm_fault *vmf) struct page *thisPage; unsigned long offset; offset = (vmf->pgoff - vma->vm_pgoff) << PAGE_SHIFT; - thisPage = virt_to_page((void *)(MWDEV_TO_MWIP(mwdev)->mem->start + offset)); + thisPage = virt_to_page((void *)(uintptr_t)(MWDEV_TO_MWIP(mwdev)->mem->start + offset)); get_page(thisPage); vmf->page = thisPage; return 0;