Use nitems() from sys/param.h.
Reviewed by: ngie MFC after: 3 weeks. Differential Revision: https://reviews.freebsd.org/D9940
This commit is contained in:
parent
97942dfb4f
commit
c86932b61b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314994
@ -420,7 +420,7 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp)
|
||||
ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr;
|
||||
ACPI_MADT_GENERIC_TRANSLATOR *gict;
|
||||
|
||||
if (mp->Type < sizeof(apic_types) / sizeof(apic_types[0]))
|
||||
if (mp->Type < nitems(apic_types))
|
||||
printf("\tType=%s\n", apic_types[mp->Type]);
|
||||
else
|
||||
printf("\tType=%d (unknown)\n", mp->Type);
|
||||
@ -470,8 +470,7 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp)
|
||||
break;
|
||||
case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
|
||||
isrc = (ACPI_MADT_INTERRUPT_SOURCE *)mp;
|
||||
if (isrc->Type < sizeof(platform_int_types) /
|
||||
sizeof(platform_int_types[0]))
|
||||
if (isrc->Type < nitems(platform_int_types))
|
||||
printf("\tType=%s\n", platform_int_types[isrc->Type]);
|
||||
else
|
||||
printf("\tType=%d (unknown)\n", isrc->Type);
|
||||
@ -1082,7 +1081,7 @@ acpi_print_srat(ACPI_SUBTABLE_HEADER *srat)
|
||||
ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic;
|
||||
ACPI_SRAT_GICC_AFFINITY *gic;
|
||||
|
||||
if (srat->Type < sizeof(srat_types) / sizeof(srat_types[0]))
|
||||
if (srat->Type < nitems(srat_types))
|
||||
printf("\tType=%s\n", srat_types[srat->Type]);
|
||||
else
|
||||
printf("\tType=%d (unknown)\n", srat->Type);
|
||||
|
Loading…
Reference in New Issue
Block a user