]> git.baikalelectronics.ru Git - kernel.git/commit
genirq: Prevent [devm_]irq_alloc_desc from returning irq 0
authorHans de Goede <hdegoede@redhat.com>
Mon, 21 Dec 2020 18:56:47 +0000 (19:56 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 5 Feb 2021 19:48:28 +0000 (20:48 +0100)
commitc61846567e21e42582185db53f290d912563ae8a
tree1d71e5d5427a5e20a8ed43b9a5472d099a51f66f
parent35126cb18a8652bf88035027d3e2265d9e404018
genirq: Prevent [devm_]irq_alloc_desc from returning irq 0

Since commit f157f2953c02 ("driver core: platform: Clarify that IRQ 0
is invalid"), having a linux-irq with number 0 will trigger a WARN()
when calling platform_get_irq*() to retrieve that linux-irq.

Since [devm_]irq_alloc_desc allocs a single irq and since irq 0 is not used
on some systems, it can return 0, triggering that WARN(). This happens
e.g. on Intel Bay Trail and Cherry Trail devices using the LPE audio engine
for HDMI audio:

 0 is an invalid IRQ number
 WARNING: CPU: 3 PID: 472 at drivers/base/platform.c:238 platform_get_irq_optional+0x108/0x180
 Modules linked in: snd_hdmi_lpe_audio(+) ...

 Call Trace:
  platform_get_irq+0x17/0x30
  hdmi_lpe_audio_probe+0x4a/0x6c0 [snd_hdmi_lpe_audio]

 ---[ end trace ceece38854223a0b ]---

Change the 'from' parameter passed to __[devm_]irq_alloc_descs() by the
[devm_]irq_alloc_desc macros from 0 to 1, so that these macros will no
longer return 0.

Fixes: f157f2953c02 ("driver core: platform: Clarify that IRQ 0 is invalid")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20201221185647.226146-1-hdegoede@redhat.com
include/linux/irq.h