irq_set_affinity_hint does not return the return value of
__irq_set_affinity, which makes the state of functions dependent
on the return value of irq_set_affinity_hint inconsistent.
Signed-off-by: Peng Hao <[email protected]>
---
kernel/irq/manage.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index ef30b4762947..86196fb826d6 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -490,6 +490,7 @@ EXPORT_SYMBOL_GPL(irq_force_affinity);
int irq_set_affinity_hint(unsigned int irq, const struct cpumask *m)
{
unsigned long flags;
+ int ret = 0;
struct irq_desc *desc = irq_get_desc_lock(irq, &flags,
IRQ_GET_DESC_CHECK_GLOBAL);
if (!desc)
@@ -498,8 +499,8 @@ int irq_set_affinity_hint(unsigned int irq, const
struct cpumask *m)
irq_put_desc_unlock(desc, flags);
/* set the initial affinity to prevent every interrupt being on CPU0 */
if (m)
- __irq_set_affinity(irq, m, false);
- return 0;
+ ret = __irq_set_affinity(irq, m, false);
+ return ret;
}
EXPORT_SYMBOL_GPL(irq_set_affinity_hint);
--
2.27.0
On Mon, Sep 06 2021 at 16:20, Hao Peng wrote:
> irq_set_affinity_hint does not return the return value of
> __irq_set_affinity, which makes the state of functions dependent
> on the return value of irq_set_affinity_hint inconsistent.
No, it does not. The affinity hint has been installed even in the case
that __irq_set_affinity() fails.
Setting the affinity in that function is a best effort operation without
any guarantees and in hindsight this should have never been added to
this function.
Thanks,
tglx