Re: [PATCH] x86/kexec: Simplify the logic of mem_region_callback()
From: Baoquan He
Date: Tue Dec 12 2023 - 21:48:09 EST
On 12/12/23 at 11:05pm, Yuntao Wang wrote:
> The expression `mstart + resource_size(res) - 1` is actually equivalent to
> `res->end`, simplify the logic of this function to improve readability.
>
> Signed-off-by: Yuntao Wang <ytcoode@xxxxxxxxx>
> ---
> arch/x86/kernel/machine_kexec_64.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
LGTM,
Acked-by: Baoquan He <bhe@xxxxxxxxxx>
>
> diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
> index 1a3e2c05a8a5..6f8df998890e 100644
> --- a/arch/x86/kernel/machine_kexec_64.c
> +++ b/arch/x86/kernel/machine_kexec_64.c
> @@ -42,12 +42,9 @@ struct init_pgtable_data {
> static int mem_region_callback(struct resource *res, void *arg)
> {
> struct init_pgtable_data *data = arg;
> - unsigned long mstart, mend;
> -
> - mstart = res->start;
> - mend = mstart + resource_size(res) - 1;
>
> - return kernel_ident_mapping_init(data->info, data->level4p, mstart, mend);
> + return kernel_ident_mapping_init(data->info, data->level4p,
> + res->start, res->end);
> }
>
> static int
> --
> 2.43.0
>