CR_2517:crypto:starfive: Fix "Unbalanced pm_runtime_enable!" warning
authorJia Jie Ho <jiajie.ho@starfivetech.com>
Tue, 1 Nov 2022 06:40:42 +0000 (14:40 +0800)
committerJia Jie Ho <jiajie.ho@starfivetech.com>
Tue, 1 Nov 2022 06:40:42 +0000 (14:40 +0800)
Crypto driver will probe multiple times waiting for
DMA to be ready, each time calling pm_runtime_enable().
Only call pm_runtime_enable() when it's not already enabled.

Signed-off-by: Jia Jie Ho <jiajie.ho@starfivetech.com>
drivers/crypto/starfive/jh7110/jh7110-sec.c

index aa6e54f..a3dc124 100755 (executable)
@@ -228,7 +228,9 @@ static int jh7110_cryp_probe(struct platform_device *pdev)
 
        pm_runtime_get_noresume(dev);
        pm_runtime_set_active(dev);
-       pm_runtime_enable(dev);
+
+       if (!pm_runtime_enabled(dev))
+               pm_runtime_enable(dev);
 
        sdev->rst_hresetn = devm_reset_control_get_shared(sdev->dev, "sec_hre");
        if (IS_ERR(sdev->rst_hresetn)) {