]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
can: c_can: fix unbalanced runtime PM disable in error path
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 12 Jan 2025 12:41:52 +0000 (13:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:47:18 +0000 (12:47 +0100)
commit 257a2cd3eb578ee63d6bf90475dc4f4b16984139 upstream.

Runtime PM is enabled as one of the last steps of probe(), so all
earlier gotos to "exit_free_device" label were not correct and were
leading to unbalanced runtime PM disable depth.

Fixes: 6e2fe01dd6f9 ("can: c_can: move runtime PM enable/disable to c_can_platform")
Cc: stable@vger.kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://patch.msgid.link/20250112-syscon-phandle-args-can-v1-1-314d9549906f@linaro.org
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/can/c_can/c_can_platform.c

index 47b251b1607cef2869d150958b11a3cefae8886e..8f0dde85e3da2bcb6f554a977306bf384230f0d1 100644 (file)
@@ -392,15 +392,16 @@ static int c_can_plat_probe(struct platform_device *pdev)
        if (ret) {
                dev_err(&pdev->dev, "registering %s failed (err=%d)\n",
                        KBUILD_MODNAME, ret);
-               goto exit_free_device;
+               goto exit_pm_runtime;
        }
 
        dev_info(&pdev->dev, "%s device registered (regs=%p, irq=%d)\n",
                 KBUILD_MODNAME, priv->base, dev->irq);
        return 0;
 
-exit_free_device:
+exit_pm_runtime:
        pm_runtime_disable(priv->device);
+exit_free_device:
        free_c_can_dev(dev);
 exit:
        dev_err(&pdev->dev, "probe failed\n");