[PATCH v3 1/2] x86/mm: rename the confusing local variable in early_memremap_is_setup_data()
Baoquan He
bhe at redhat.com
Wed Oct 30 20:41:12 PDT 2024
On 10/30/24 at 07:49am, Tom Lendacky wrote:
> On 10/29/24 19:53, Baoquan He wrote:
> > On 10/29/24 at 07:11pm, Borislav Petkov wrote:
> >> On Wed, Sep 11, 2024 at 04:16:14PM +0800, Baoquan He wrote:
> >>> In function early_memremap_is_setup_data(), parameter 'size' passed has
> >>> the same name as the local variable inside the while loop. That
> >>> confuses people who sometime mix up them when reading code.
> >>>
> >>> Here rename the local variable 'size' inside while loop to 'sd_size'.
> >>>
> >>> And also add one local variable 'sd_size' likewise in function
> >>> memremap_is_setup_data() to simplify code. In later patch, this can also
> >>> be used.
> >>>
> >>> Signed-off-by: Baoquan He <bhe at redhat.com>
> >>> Acked-by: Tom Lendacky <thomas.lendacky at amd.com>
> >>> ---
> >>> arch/x86/mm/ioremap.c | 18 +++++++++++-------
> >>> 1 file changed, 11 insertions(+), 7 deletions(-)
> >>>
> >>> diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
> >>> index aa7d279321ea..f1ee8822ddf1 100644
> >>> --- a/arch/x86/mm/ioremap.c
> >>> +++ b/arch/x86/mm/ioremap.c
> >>> @@ -640,7 +640,7 @@ static bool memremap_is_setup_data(resource_size_t phys_addr,
> >>
> >> Huh?
> >
> > Thanks for looking into this.
> >
> > I ever doubted this, guess it could use the unused 'size' to avoid
> > warning? Noticed Tom introduced it at the beginning. It's better idea to
> > remove it if it's useless.
> >
> > commit 8f716c9b5febf6ed0f5fedb7c9407cd0c25b2796
> > Author: Tom Lendacky <thomas.lendacky at amd.com>
> > Date: Mon Jul 17 16:10:16 2017 -0500
> >
> > x86/mm: Add support to access boot related data in the clear
> >
> > Hi Tom,
> >
> > Can you help check and tell your intention why the argument 'size' is
> > added into early_memremap_is_setup_data() and memremap_is_setup_data().
>
> That was a long time ago... I probably used it while I was developing the
> support and then never removed it in the final version where it wasn't used.
Thanks for confirming. Then we can remove it to avoid confusion.
Hi Boris,
Should I send the fixing patch alone and clean up the useless argument
'size' later, or squash them into one patch?
Thanks
Baoquan
More information about the kexec
mailing list