]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
staging: greybus: arche-platform: fix coldboot probe error path
authorJohan Hovold <johan@kernel.org>
Fri, 19 Dec 2025 10:59:26 +0000 (11:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Dec 2025 08:43:11 +0000 (09:43 +0100)
Make sure to deregister the PM notifier in case the coldboot sequence
fails during probe.

Fixes: d29b67d44a7c ("greybus: arche-platform: Add support for init-off feature")
Reported-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://lore.kernel.org/lkml/20251104090825.224-1-vulab@iscas.ac.cn/
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20251219105928.23329-2-johan@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/greybus/arche-platform.c

index d48464390f58e23af3d1c2c83d7e3dd8c3a75132..bd069d75391b04f49784b080d943754ffa9fb246 100644 (file)
@@ -534,8 +534,9 @@ static int arche_platform_probe(struct platform_device *pdev)
                mutex_lock(&arche_pdata->platform_state_mutex);
                ret = arche_platform_coldboot_seq(arche_pdata);
                if (ret) {
+                       mutex_unlock(&arche_pdata->platform_state_mutex);
                        dev_err(dev, "Failed to cold boot svc %d\n", ret);
-                       goto err_coldboot;
+                       goto err_unregister_pm_notifier;
                }
                arche_platform_wd_irq_en(arche_pdata);
                mutex_unlock(&arche_pdata->platform_state_mutex);
@@ -544,8 +545,8 @@ static int arche_platform_probe(struct platform_device *pdev)
        dev_info(dev, "Device registered successfully\n");
        return 0;
 
-err_coldboot:
-       mutex_unlock(&arche_pdata->platform_state_mutex);
+err_unregister_pm_notifier:
+       unregister_pm_notifier(&arche_pdata->pm_notifier);
 err_device_remove:
        device_remove_file(&pdev->dev, &dev_attr_state);
        return ret;