[PATCH v2 03/28] efi_loader: Drop extra brackets in efi_mem_carve_out()
Simon Glass
sjg at chromium.org
Thu Nov 28 20:10:51 CET 2024
Hi Heinrich,
On Thu, 28 Nov 2024 at 09:55, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 28.11.24 16:47, Simon Glass wrote:
> > Simplify a few expressions in this function.
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
> > ---
> >
> > (no changes since v1)
> >
> > lib/efi_loader/efi_memory.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
> > index f1154f73e05..3b1c7528e92 100644
> > --- a/lib/efi_loader/efi_memory.c
> > +++ b/lib/efi_loader/efi_memory.c
> > @@ -206,11 +206,11 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map,
> > (carve_desc->num_pages << EFI_PAGE_SHIFT);
> >
> > /* check whether we're overlapping */
> > - if ((carve_end <= map_start) || (carve_start >= map_end))
> > + if (carve_end <= map_start || carve_start >= map_end)
>
> As operator precedence is not always easy to remember, some people like
> Alex and some static code analysis tools prefer parentheses.
It seems silly to have brackets in this case. It just makes the code
harder to read and checkpatch doesn't like it.
>
> > return EFI_CARVE_NO_OVERLAP;
> >
> > /* We're overlapping with non-RAM, warn the caller if desired */
> > - if (overlap_conventional && (map_desc->type != EFI_CONVENTIONAL_MEMORY))
> > + if (overlap_conventional && map_desc->type != EFI_CONVENTIONAL_MEMORY)
>
> ditto
ditto
>
> We should get rid of this code as it duplicates what we already have in
> LMB and generate the UEFI memory map from from LMB.
OK, please send a patch.
>
> > return EFI_CARVE_OVERLAPS_NONRAM;
> >
> > /* Sanitize carve_start and carve_end to lie within our bounds */
>
Regards,
Simon
More information about the U-Boot
mailing list