* [PATCH linux-5.15.y] RISC-V: Fix up a cherry-pick warning in setup_vm_final()
@ 2023-04-29 22:43 Palmer Dabbelt
2023-05-01 7:33 ` Alexandre Ghiti
0 siblings, 1 reply; 3+ messages in thread
From: Palmer Dabbelt @ 2023-04-29 22:43 UTC (permalink / raw)
To: Greg KH; +Cc: stable, linux-riscv, Palmer Dabbelt, kernel test robot
This triggers a -Wdeclaration-after-statement as the code has changed a
bit since upstream. It might be better to hoist the whole block up, but
this is a smaller change so I went with it.
arch/riscv/mm/init.c:755:16: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement]
unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
^
1 warning generated.
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202304300429.SXZOA5up-lkp@intel.com/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
I haven't even build tested this one, but it looks simple enough that I figured
I'd just send it. Be warned, though: I broke glibc and missed a merged
conflict yesterday...
---
arch/riscv/mm/init.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index e800d7981e99..8d67f43f1865 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -717,6 +717,7 @@ static void __init setup_vm_final(void)
uintptr_t va, map_size;
phys_addr_t pa, start, end;
u64 i;
+ unsigned long idx;
/**
* MMU is enabled at this point. But page table setup is not complete yet.
@@ -735,7 +736,7 @@ static void __init setup_vm_final(void)
* directly in swapper_pg_dir in addition to the pgd entry that points
* to fixmap_pte.
*/
- unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
+ idx = pgd_index(__fix_to_virt(FIX_FDT));
set_pgd(&swapper_pg_dir[idx], early_pg_dir[idx]);
#endif
--
2.40.0
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH linux-5.15.y] RISC-V: Fix up a cherry-pick warning in setup_vm_final()
2023-04-29 22:43 [PATCH linux-5.15.y] RISC-V: Fix up a cherry-pick warning in setup_vm_final() Palmer Dabbelt
@ 2023-05-01 7:33 ` Alexandre Ghiti
2023-05-06 0:56 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Ghiti @ 2023-05-01 7:33 UTC (permalink / raw)
To: Palmer Dabbelt, Greg KH; +Cc: stable, linux-riscv, kernel test robot
Hi Palmer,
On 4/30/23 00:43, Palmer Dabbelt wrote:
> This triggers a -Wdeclaration-after-statement as the code has changed a
> bit since upstream. It might be better to hoist the whole block up, but
> this is a smaller change so I went with it.
>
> arch/riscv/mm/init.c:755:16: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement]
> unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
> ^
> 1 warning generated.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/oe-kbuild-all/202304300429.SXZOA5up-lkp@intel.com/
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> ---
> I haven't even build tested this one, but it looks simple enough that I figured
> I'd just send it. Be warned, though: I broke glibc and missed a merged
> conflict yesterday...
> ---
> arch/riscv/mm/init.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index e800d7981e99..8d67f43f1865 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -717,6 +717,7 @@ static void __init setup_vm_final(void)
> uintptr_t va, map_size;
> phys_addr_t pa, start, end;
> u64 i;
> + unsigned long idx;
>
> /**
> * MMU is enabled at this point. But page table setup is not complete yet.
> @@ -735,7 +736,7 @@ static void __init setup_vm_final(void)
> * directly in swapper_pg_dir in addition to the pgd entry that points
> * to fixmap_pte.
> */
> - unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
> + idx = pgd_index(__fix_to_virt(FIX_FDT));
>
> set_pgd(&swapper_pg_dir[idx], early_pg_dir[idx]);
> #endif
The above results to in rv64:
../arch/riscv/mm/init.c: In function ‘setup_vm_final’:
../arch/riscv/mm/init.c:720:16: warning: unused variable ‘idx’
[-Wunused-variable]
720 | unsigned long idx;
The following fixes this warning:
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 8d67f43f1865..e69d82d573f1 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -717,7 +717,7 @@ static void __init setup_vm_final(void)
uintptr_t va, map_size;
phys_addr_t pa, start, end;
u64 i;
- unsigned long idx;
+ unsigned long idx __maybe_unused;
/**
* MMU is enabled at this point. But page table setup is not
complete yet.
Let me know if you want me to send a proper patch as I'm the one to
blame here.
Thanks for your patch,
Alex
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH linux-5.15.y] RISC-V: Fix up a cherry-pick warning in setup_vm_final()
2023-05-01 7:33 ` Alexandre Ghiti
@ 2023-05-06 0:56 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2023-05-06 0:56 UTC (permalink / raw)
To: Alexandre Ghiti; +Cc: Palmer Dabbelt, stable, linux-riscv, kernel test robot
On Mon, May 01, 2023 at 09:33:25AM +0200, Alexandre Ghiti wrote:
> Hi Palmer,
>
> On 4/30/23 00:43, Palmer Dabbelt wrote:
> > This triggers a -Wdeclaration-after-statement as the code has changed a
> > bit since upstream. It might be better to hoist the whole block up, but
> > this is a smaller change so I went with it.
> >
> > arch/riscv/mm/init.c:755:16: warning: mixing declarations and code is a C99 extension [-Wdeclaration-after-statement]
> > unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
> > ^
> > 1 warning generated.
> >
> > Reported-by: kernel test robot <lkp@intel.com>
> > Link: https://lore.kernel.org/oe-kbuild-all/202304300429.SXZOA5up-lkp@intel.com/
> > Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
> > ---
> > I haven't even build tested this one, but it looks simple enough that I figured
> > I'd just send it. Be warned, though: I broke glibc and missed a merged
> > conflict yesterday...
> > ---
> > arch/riscv/mm/init.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> > index e800d7981e99..8d67f43f1865 100644
> > --- a/arch/riscv/mm/init.c
> > +++ b/arch/riscv/mm/init.c
> > @@ -717,6 +717,7 @@ static void __init setup_vm_final(void)
> > uintptr_t va, map_size;
> > phys_addr_t pa, start, end;
> > u64 i;
> > + unsigned long idx;
> > /**
> > * MMU is enabled at this point. But page table setup is not complete yet.
> > @@ -735,7 +736,7 @@ static void __init setup_vm_final(void)
> > * directly in swapper_pg_dir in addition to the pgd entry that points
> > * to fixmap_pte.
> > */
> > - unsigned long idx = pgd_index(__fix_to_virt(FIX_FDT));
> > + idx = pgd_index(__fix_to_virt(FIX_FDT));
> > set_pgd(&swapper_pg_dir[idx], early_pg_dir[idx]);
> > #endif
>
> The above results to in rv64:
>
> ../arch/riscv/mm/init.c: In function ‘setup_vm_final’:
> ../arch/riscv/mm/init.c:720:16: warning: unused variable ‘idx’
> [-Wunused-variable]
> 720 | unsigned long idx;
>
>
> The following fixes this warning:
>
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 8d67f43f1865..e69d82d573f1 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -717,7 +717,7 @@ static void __init setup_vm_final(void)
> uintptr_t va, map_size;
> phys_addr_t pa, start, end;
> u64 i;
> - unsigned long idx;
> + unsigned long idx __maybe_unused;
>
> /**
> * MMU is enabled at this point. But page table setup is not
> complete yet.
>
>
> Let me know if you want me to send a proper patch as I'm the one to blame
> here.
As the original fix here will not work, a "correct" one might be best to
have :)
thanks,
greg k-h
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-06 5:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-29 22:43 [PATCH linux-5.15.y] RISC-V: Fix up a cherry-pick warning in setup_vm_final() Palmer Dabbelt
2023-05-01 7:33 ` Alexandre Ghiti
2023-05-06 0:56 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).