]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
hwrng: ks-sa - Fix runtime PM imbalance on error
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Thu, 28 May 2020 07:21:04 +0000 (15:21 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:37:03 +0000 (15:37 -0400)
[ Upstream commit 95459261c99f1621d90bc628c2a48e60b7cf9a88 ]

pm_runtime_get_sync() increments the runtime PM usage counter even
the call returns an error code. Thus a pairing decrement is needed
on the error handling path to keep the counter balanced.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/char/hw_random/ks-sa-rng.c

index a67430010aa68b7600fc438a954e8e1c11ff0844..5c7d3dfcfdd0432d9cef6d04d98c4b31f1e6a4a9 100644 (file)
@@ -208,6 +208,7 @@ static int ks_sa_rng_probe(struct platform_device *pdev)
        ret = pm_runtime_get_sync(dev);
        if (ret < 0) {
                dev_err(dev, "Failed to enable SA power-domain\n");
+               pm_runtime_put_noidle(dev);
                pm_runtime_disable(dev);
                return ret;
        }