drivers: imx: interrupts: Fix portability issue in internal function

The function irqstr_get_status_word had hardcoded bounds checks that
are correct for i.MX8/i.MX8X platforms but don't work for the new i.MX8M
platform. This commit adjusts the bounds checks so they work on all
platforms.

Signed-off-by: Paul Olaru <paul.olaru@nxp.com>
This commit is contained in:
Paul Olaru 2020-03-09 14:18:26 +02:00 committed by Daniel Baluta
parent 30492d73f9
commit 36ba9fbd75
1 changed files with 2 additions and 3 deletions

View File

@ -159,11 +159,10 @@ static void irqstr_disable_hw(void)
*/
static uint32_t irqstr_get_status_word(uint32_t index)
{
/* First 32 interrupts are reserved, we just give 0 */
if (!index)
if (index < IRQSTR_RESERVED_IRQS_NUM / 32)
return 0;
/* On out of range for our platform, be silent */
if (index > 15)
if (index >= IRQSTR_IRQS_REGISTERS_NUM)
return 0;
return irqstr_read(IRQSTR_CH_STATUS(index));
}