mfd: intel_soc_pmic_crc: balance IRQ wake enable
PATCH 1/1 mfd: intel_soc_pmic_crc: balance IRQ wake enable
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.
Register a managed action only after enable_irq_wake() succeeds. Since the action is registered after the managed regmap IRQ chip, reverse devres order disables IRQ wake before tearing down the IRQ chip. Keep warning and continuing when enable_irq_wake() itself fails.
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.
--- drivers/mfd/intel_soc_pmic_crc.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/mfd/intel_soc_pmic_crc.c +14 -1
@@ -164,6 +164,13 @@ static const struct crystal_cove_config crystal_cove_config_cht_crc = { .irq_chip = &crystal_cove_irq_chip, }; +static void crystal_cove_disable_irq_wake (void *data) +{ +struct intel_soc_pmic *pmic = data; + +disable_irq_wake (pmic->irq); +} +static int crystal_cove_i2c_probe (struct i2c_client *i2c) {const struct crystal_cove_config *config;
@@ -195,8 +202,14 @@ static int crystal_cove_i2c_probe(struct i2c_client *i2c)return ret; ret =enable_irq_wake (pmic->irq); -if (ret) +if (ret) {dev_warn (dev,"Can't enable IRQ as wake source: %d\n" , ret); + }else { + ret =devm_add_action_or_reset (dev, + crystal_cove_disable_irq_wake, pmic); +if (ret) +return ret; + }/* Add lookup table for crc-pwm */ pwm_add_table (crc_pwm_lookup,ARRAY_SIZE (crc_pwm_lookup));
Signature · 1 line
2.47.1
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Low] The commit message description is not capitalized, violating MFD subsystem guidelines. --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The commit message description is not capitalized, violating MFD subsystem guidelines. --
commit 1d76dffa1adc4e20f1503c7cc9b8a6f0608c2bfb
Author: Myeonghun Pak <[email protected]>
mfd: intel_soc_pmic_crc: balance IRQ wake enable
This commit balances IRQ wake enabling for the INT33FD Crystal Cove driver. It registers a managed action to disable the wake source only after a successful call to enable_irq_wake(), ensuring proper teardown upon failure or device removal.
Quoted 1 line
mfd:
intel_soc_pmic_crc: balance IRQ wake enable
[Severity: Low]
This isn't a bug, but does the commit message description need to be capitalized to follow MFD subsystem naming conventions? The guidelines specify always capitalizing the description after the subsystem prefix for MFD, such as "mfd: intel_soc_pmic_crc: Balance IRQ wake enable".
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 15 lines · Myeonghun Pak
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.Register a managed action only after
enable_irq_wake()succeeds. Since the action is registered after the managed regmap IRQ chip, reverse devres order disables IRQ wake before tearing down the IRQ chip. Keep warning and continuing whenenable_irq_wake()itself fails.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.
...
Quoted 1 line
Assisted-by OpenAI:GPT-5.6
...
drivers/mfd/intel_soc_pmic_crc.c static int crystal_cove_i2c_probe(struct i2c_client *i2c) · line 209
Quoted 7 lines
drivers/mfd/intel_soc_pmic_crc.c +4
-1ret =enable_irq_wake (pmic->irq); -if (ret) +if (ret) {dev_warn (dev,"Can't enable IRQ as wake source: %d\n" , ret); + }else { + ret =devm_add_action_or_reset (dev, + crystal_cove_disable_irq_wake, pmic);
Make it a single line.
drivers/mfd/intel_soc_pmic_crc.c static int crystal_cove_i2c_probe(struct i2c_client *i2c) · line 212
Quoted 3 lines
drivers/mfd/intel_soc_pmic_crc.c +3
-0+if (ret) +return ret; + }
Shouldn't disable_irq_wake() be called at .shutdown() as well?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hello Andy,
Thanks for the review. I'll address these in v2, including releasing the wake-disable action at shutdown only if it was registered.
Best regards,
Myeonghun Pak
2026년 9월 14일 (월) 오전 4:32, Andy Shevchenko <[email protected]>님이 작성:
Quoted 48 lines · Myeonghun Pak
Quoted 15 lines
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.Register a managed action only after
enable_irq_wake()succeeds. Since the action is registered after the managed regmap IRQ chip, reverse devres order disables IRQ wake before tearing down the IRQ chip. Keep warning and continuing whenenable_irq_wake()itself fails.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.
...
Quoted 1 line
Assisted-by OpenAI:GPT-5.6Assisted-by LLM...
drivers/mfd/intel_soc_pmic_crc.c static int crystal_cove_i2c_probe(struct i2c_client *i2c) · line 209
Quoted 7 lines
ret = enable_irq_wake(pmic->irq);drivers/mfd/intel_soc_pmic_crc.c +4
-1-if (ret) +if (ret) {dev_warn (dev,"Can't enable IRQ as wake source: %d\n" , ret); + }else { + ret =devm_add_action_or_reset (dev, + crystal_cove_disable_irq_wake, pmic);Make it a single line.
drivers/mfd/intel_soc_pmic_crc.c static int crystal_cove_i2c_probe(struct i2c_client *i2c) · line 212
Quoted 3 lines
drivers/mfd/intel_soc_pmic_crc.c +3
-0+if (ret) +return ret; + }Shouldn't
disable_irq_wake()be called at .shutdown() as well?--
With Best Regards,
Andy Shevchenko