clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 16 Oct 2019 14:30:03 +0000 (16:30 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 18 Oct 2019 05:55:16 +0000 (07:55 +0200)
commit7693de9f7aa4e2993fbd7094863304be6a4bbe16
tree8288e157dab1323a6a4b3a433f0c247478a46777
parent41d49e7939de5ec532d86494185b2ca2e99c848a
clocksource/drivers/sh_mtu2: Do not loop using platform_get_irq_by_name()

As platform_get_irq_by_name() now prints an error when the interrupt
does not exist, looping over possibly non-existing interrupts causes the
printing of scary messages like:

    sh_mtu2 fcff0000.timer: IRQ tgi1a not found
    sh_mtu2 fcff0000.timer: IRQ tgi2a not found

Fix this by using the platform_irq_count() helper, to avoid touching
non-existent interrupts.  Limit the returned number of interrupts to the
maximum number of channels currently supported by the driver in a
future-proof way, i.e. using ARRAY_SIZE() instead of a hardcoded number.

Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20191016143003.28561-1-geert+renesas@glider.be
drivers/clocksource/sh_mtu2.c