[PATCH 3/4] firmware: smccc: lfa: Fix probe and notification rollback
Jiangtian Feng
jiangtianfeng at linux.alibaba.com
Wed Dec 2 17:38:16 PST 2026
A successful ACPI or DT notification registration returns zero, so the
existing err != -ENODEV condition tears down the kset and workqueue
before returning success. Only enter teardown for real errors.
Also clean partially created child kobjects on inventory failure and
unregister notification resources before rolling back workqueue state.
Link: https://lore.kernel.org/all/c9f66683-7902-4b5c-9f76-c55b1894ce9c@nvidia.com/
Link: https://lore.kernel.org/all/705b63c3-297a-4bf8-9eb2-b826e280e7da@nvidia.com/
Signed-off-by: Jiangtian Feng <jiangtianfeng at linux.alibaba.com>
---
drivers/firmware/smccc/lfa_fw.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/smccc/lfa_fw.c b/drivers/firmware/smccc/lfa_fw.c
index 1864176f3410..0a3bbf76e5f7 100644
--- a/drivers/firmware/smccc/lfa_fw.c
+++ b/drivers/firmware/smccc/lfa_fw.c
@@ -996,6 +996,8 @@ static int lfa_smccc_probe(struct arm_smccc_device *sdev)
err = update_fw_components_tree();
if (err != 0) {
+ flush_workqueue(fw_comps_update_wq);
+ clean_fw_components_tree();
kset_unregister(lfa_kset);
destroy_workqueue(fw_comps_update_wq);
return err;
@@ -1015,7 +1017,13 @@ static int lfa_smccc_probe(struct arm_smccc_device *sdev)
* An ACPI notification or an interrupt are optional, but we must
* handle errors that occurred during their setup.
*/
- if (err != -ENODEV) {
+ if (err && err != -ENODEV) {
+ if (!acpi_disabled)
+ lfa_remove_acpi(&sdev->dev);
+ if (lfa_irq)
+ devm_free_irq(&sdev->dev, lfa_irq, NULL);
+ flush_workqueue(fw_comps_update_wq);
+ clean_fw_components_tree();
kset_unregister(lfa_kset);
destroy_workqueue(fw_comps_update_wq);
return err;
--
2.47.3
More information about the linux-arm-kernel
mailing list