diff options
| author | Yann Gautier <yann.gautier@st.com> | 2026-05-06 19:19:50 +0200 |
|---|---|---|
| committer | Yann Gautier <yann.gautier@st.com> | 2026-06-23 09:08:22 +0200 |
| commit | df0ee912fee0f07cd533889dd3c410636625b8ff (patch) | |
| tree | ba27938b301c3ace0519be8b50d771069672a49d | |
| parent | 552ca6fa44d0cb0225346f0bd0272823af7e30ea (diff) | |
| download | arm-trusted-firmware-df0ee912fee0f07cd533889dd3c410636625b8ff.tar.gz arm-trusted-firmware-df0ee912fee0f07cd533889dd3c410636625b8ff.zip | |
fix(platforms): check MIN_SGI_ID at compile time
MIN_SGI_ID is 0 by default in GIC v2 or v3. It could then be useless to
check if an SGI interrupt ID is above this, as the ID is already an
unsigned int.
This avoids the following warning when enabling W=1 in the command line.
plat/common/plat_gicv2.c:180:20: warning: comparison of unsigned
expression in '>= 0' is always true [-Wtype-limits]
180 | return (id >= MIN_SGI_ID) && (id < MIN_PPI_ID);
| ^~
Change-Id: I45a51eaa1894d2723476e9c0dedb90a2540854de
Signed-off-by: Yann Gautier <yann.gautier@st.com>
| -rw-r--r-- | drivers/arm/gic/v3/gicv3_main.c | 2 | ||||
| -rw-r--r-- | plat/common/plat_gicv2.c | 4 | ||||
| -rw-r--r-- | plat/common/plat_gicv3.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/drivers/arm/gic/v3/gicv3_main.c b/drivers/arm/gic/v3/gicv3_main.c index baaca5fca..7ef5559f2 100644 --- a/drivers/arm/gic/v3/gicv3_main.c +++ b/drivers/arm/gic/v3/gicv3_main.c @@ -1144,7 +1144,7 @@ void gicv3_raise_sgi(unsigned int sgi_num, gicv3_irq_group_t group, uint64_t sgi_val; /* Verify interrupt number is in the SGI range */ - assert((sgi_num >= MIN_SGI_ID) && (sgi_num < MIN_PPI_ID)); + assert(sgi_num < MIN_PPI_ID); /* Extract affinity fields from target */ aff0 = (unsigned int)MPIDR_AFFLVL0_VAL(target); diff --git a/plat/common/plat_gicv2.c b/plat/common/plat_gicv2.c index 1edccd144..694142a15 100644 --- a/plat/common/plat_gicv2.c +++ b/plat/common/plat_gicv2.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2023, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2026, Arm Limited and Contributors. All rights reserved. * Portions copyright (c) 2021-2022, ProvenRun S.A.S. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -177,7 +177,7 @@ bool plat_ic_is_ppi(unsigned int id) bool plat_ic_is_sgi(unsigned int id) { - return (id >= MIN_SGI_ID) && (id < MIN_PPI_ID); + return (id < MIN_PPI_ID); } unsigned int plat_ic_get_interrupt_active(unsigned int id) diff --git a/plat/common/plat_gicv3.c b/plat/common/plat_gicv3.c index d4ba9ac5f..939efeb58 100644 --- a/plat/common/plat_gicv3.c +++ b/plat/common/plat_gicv3.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved. + * Copyright (c) 2015-2026, Arm Limited and Contributors. All rights reserved. * Portions copyright (c) 2021-2022, ProvenRun S.A.S. All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -214,7 +214,7 @@ bool plat_ic_is_ppi(unsigned int id) bool plat_ic_is_sgi(unsigned int id) { - return (id >= MIN_SGI_ID) && (id < MIN_PPI_ID); + return (id < MIN_PPI_ID); } unsigned int plat_ic_get_interrupt_active(unsigned int id) |
