media: venus: venc: Fix runtime PM imbalance in venc_open
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sun, 24 May 2020 04:31:32 +0000 (06:31 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sat, 4 Jul 2020 10:26:09 +0000 (12:26 +0200)
pm_runtime_get_sync() increments the runtime PM usage counter even
when it 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>
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/platform/qcom/venus/venc.c

index feed648..513bbc0 100644 (file)
@@ -1177,7 +1177,7 @@ static int venc_open(struct file *file)
 
        ret = pm_runtime_get_sync(core->dev_enc);
        if (ret < 0)
-               goto err_free_inst;
+               goto err_put_sync;
 
        ret = venc_ctrl_init(inst);
        if (ret)
@@ -1222,7 +1222,6 @@ err_ctrl_deinit:
        venc_ctrl_deinit(inst);
 err_put_sync:
        pm_runtime_put_sync(core->dev_enc);
-err_free_inst:
        kfree(inst);
        return ret;
 }