]> git.dujemihanovic.xyz Git - linux.git/commitdiff
i2c: davinci: fix PM disable depth imbalance in davinci_i2c_probe
authorZhang Qilong <zhangqilong3@huawei.com>
Thu, 29 Sep 2022 14:30:38 +0000 (22:30 +0800)
committerWolfram Sang <wsa@kernel.org>
Sat, 1 Oct 2022 22:46:42 +0000 (00:46 +0200)
The pm_runtime_enable will increase power disable depth. Thus a
pairing decrement is needed on the error handling path to keep
it balanced according to context.

Fixes: 17f88151ff190 ("i2c: davinci: Add PM Runtime Support")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-davinci.c

index 471c47db546bf8ddffc9b069d8a58a1793bbed4a..c836cf8841850ac10d167c7c941f06b438c7c07d 100644 (file)
@@ -823,7 +823,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
        r = pm_runtime_resume_and_get(dev->dev);
        if (r < 0) {
                dev_err(dev->dev, "failed to runtime_get device: %d\n", r);
-               return r;
+               goto err_pm;
        }
 
        i2c_davinci_init(dev);
@@ -882,6 +882,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
 err_unuse_clocks:
        pm_runtime_dont_use_autosuspend(dev->dev);
        pm_runtime_put_sync(dev->dev);
+err_pm:
        pm_runtime_disable(dev->dev);
 
        return r;