Skip to content

Commit 4c7bcb5

Browse files
jwrdegoedeKAGA-KOKO
authored andcommitted
genirq: Prevent [devm_]irq_alloc_desc from returning irq 0
Since commit a85a6c8 ("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: a85a6c8 ("driver core: platform: Clarify that IRQ 0 is invalid") Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 4c457e8 commit 4c7bcb5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/linux/irq.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,7 @@ int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from,
928928
__irq_alloc_descs(irq, from, cnt, node, THIS_MODULE, NULL)
929929

930930
#define irq_alloc_desc(node) \
931-
irq_alloc_descs(-1, 0, 1, node)
931+
irq_alloc_descs(-1, 1, 1, node)
932932

933933
#define irq_alloc_desc_at(at, node) \
934934
irq_alloc_descs(at, at, 1, node)
@@ -943,7 +943,7 @@ int __devm_irq_alloc_descs(struct device *dev, int irq, unsigned int from,
943943
__devm_irq_alloc_descs(dev, irq, from, cnt, node, THIS_MODULE, NULL)
944944

945945
#define devm_irq_alloc_desc(dev, node) \
946-
devm_irq_alloc_descs(dev, -1, 0, 1, node)
946+
devm_irq_alloc_descs(dev, -1, 1, 1, node)
947947

948948
#define devm_irq_alloc_desc_at(dev, at, node) \
949949
devm_irq_alloc_descs(dev, at, at, 1, node)

0 commit comments

Comments
 (0)