mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ARM: mm: fix warning on phys_addr_t to void pointer assignment
@ 2022-12-13 19:18 Giulio Benetti
  2022-12-28 10:49 ` Naresh Kamboju
  0 siblings, 1 reply; 2+ messages in thread
From: Giulio Benetti @ 2022-12-13 19:18 UTC (permalink / raw)
  To: Russell King, Arnd Bergmann
  Cc: Nathan Chancellor, Nick Desaulniers, Tom Rix, Giulio Benetti,
	Russell King (Oracle),
	Will Deacon, Kefeng Wang, linux-arm-kernel, linux-kernel, llvm,
	Naresh Kamboju, stable

zero_page is a void* pointer but memblock_alloc() returns phys_addr_t type
so this generates a warning while using clang and with -Wint-error enabled
that becomes and error. So let's cast the return of memblock_alloc() to
(void *).

Cc: <stable@vger.kernel.org> # 4.14.x +
Fixes: 340a982825f7 ("ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation")
Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
---
 arch/arm/mm/nommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index c1494a4dee25..53f2d8774fdb 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -161,7 +161,7 @@ void __init paging_init(const struct machine_desc *mdesc)
 	mpu_setup();
 
 	/* allocate the zero page. */
-	zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
+	zero_page = (void *)memblock_alloc(PAGE_SIZE, PAGE_SIZE);
 	if (!zero_page)
 		panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
 		      __func__, PAGE_SIZE, PAGE_SIZE);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: mm: fix warning on phys_addr_t to void pointer assignment
  2022-12-13 19:18 [PATCH] ARM: mm: fix warning on phys_addr_t to void pointer assignment Giulio Benetti
@ 2022-12-28 10:49 ` Naresh Kamboju
  0 siblings, 0 replies; 2+ messages in thread
From: Naresh Kamboju @ 2022-12-28 10:49 UTC (permalink / raw)
  To: Giulio Benetti
  Cc: Russell King, Arnd Bergmann, Nathan Chancellor, Nick Desaulniers,
	Tom Rix, Russell King (Oracle),
	Will Deacon, Kefeng Wang, linux-arm-kernel, linux-kernel, llvm,
	stable

On Wed, 14 Dec 2022 at 00:48, Giulio Benetti
<giulio.benetti@benettiengineering.com> wrote:
>
> zero_page is a void* pointer but memblock_alloc() returns phys_addr_t type
> so this generates a warning while using clang and with -Wint-error enabled
> that becomes and error. So let's cast the return of memblock_alloc() to
> (void *).
>
> Cc: <stable@vger.kernel.org> # 4.14.x +
> Fixes: 340a982825f7 ("ARM: 9266/1: mm: fix no-MMU ZERO_PAGE() implementation")
> Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>


> ---
>  arch/arm/mm/nommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
> index c1494a4dee25..53f2d8774fdb 100644
> --- a/arch/arm/mm/nommu.c
> +++ b/arch/arm/mm/nommu.c
> @@ -161,7 +161,7 @@ void __init paging_init(const struct machine_desc *mdesc)
>         mpu_setup();
>
>         /* allocate the zero page. */
> -       zero_page = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
> +       zero_page = (void *)memblock_alloc(PAGE_SIZE, PAGE_SIZE);
>         if (!zero_page)
>                 panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
>                       __func__, PAGE_SIZE, PAGE_SIZE);
> --
> 2.34.1


--
Linaro LKFT
https://lkft.linaro.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-28 10:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13 19:18 [PATCH] ARM: mm: fix warning on phys_addr_t to void pointer assignment Giulio Benetti
2022-12-28 10:49 ` Naresh Kamboju

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®