Re: [PATCH v3] mfd: intel_soc_pmic_crc: Balance IRQ wake enable

From: Andy Shevchenko

Date: Fri Sep 18 2026 - 03:16:37 EST


On Thu, Sep 17, 2026 at 01:36:25PM -0500, Myeonghun Pak wrote:
> The INT33FD Crystal Cove driver enables the parent IRQ as a wake source
> after registering its regmap IRQ chip. When that succeeds, a later
> mfd_add_devices() failure or driver removal leaves the wake enable
> unbalanced.
>
> Record whether enable_irq_wake() succeeded and disable IRQ wake on a
> subsequent mfd_add_devices() failure or driver removal. On removal, do
> this after removing the MFD children and before the managed regmap IRQ
> chip is released. Keep warning and continuing when enable_irq_wake()
> itself fails, without attempting to disable wake in that case.
>
> This is limited to the Bay Trail and Cherry Trail Crystal Cove PMIC
> variants using the INT33FD ACPI ID.
>
> This issue was identified during our ongoing static-analysis research while
> reviewing kernel code.

...

> ret = enable_irq_wake(pmic->irq);
> if (ret)
> dev_warn(dev, "Can't enable IRQ as wake source: %d\n", ret);

> + else
> + pmic->irq_wake_enabled = true;

No need. Hint: we have irqd_is_wakeup_set().

...

> config->n_cell_devs, NULL, 0,
> regmap_irq_get_domain(pmic->irq_chip_data));
> - if (ret)
> + if (ret) {
> pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup));
> + if (pmic->irq_wake_enabled)
> + disable_irq_wake(pmic->irq);
> + }
>
> return ret;
> }
>
> static void crystal_cove_i2c_remove(struct i2c_client *i2c)
> {
> + struct intel_soc_pmic *pmic = i2c_get_clientdata(i2c);
> +
> /* remove crc-pwm lookup table */
> pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup));
>
> mfd_remove_devices(&i2c->dev);
> + if (pmic->irq_wake_enabled)
> + disable_irq_wake(pmic->irq);

Hmm... This looks like another possible bug as we remove table before removing
the MFD devices. Not sure if this is okay. Can you check that as well? Perhaps
we would need another fix-patch.

> }

--
With Best Regards,
Andy Shevchenko