We support up to 8 CPUs, not 9. Avoid future overflows by using the
actual size of target_cpu_map as limit.
This addresses Coverity finding CID 21114.
Adjust comment wordings at this chance as well.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
* Get the CPU interface ID for this cpu. It can be discovered by reading
* the banked value of the PPI and IPI TARGET registers
* Patch 2bb3135 in Linux explains why the probe may need to scans the first 8
- * registers: some early implementation returned 0 for the first TARGETS
- * registributor.
+ * registers: some early implementation returned 0 for the first ITARGETSR
+ * registers.
* Since those didn't have virtualization extensions, we can safely ignore that
* case.
*/
int gic_probe_cpu_id(unsigned int cpu)
{
- if (cpu > 8)
+ if (cpu >= ARRAY_SIZE(target_cpu_map))
return -EINVAL;
target_cpu_map[cpu] = mmio_read32(gicd_base + GICD_ITARGETSR);