In case vb2ops_venc_start_streaming fails, the error value
is overwritten by the ret value of pm_runtime_put which might
be 0. Fix it.
Fixes: 985c73693fe5a (" media: mtk-vcodec: Separating mtk encoder driver")
Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
 {
        struct mtk_vcodec_ctx *ctx = vb2_get_drv_priv(q);
        struct venc_enc_param param;
-       int ret;
+       int ret, pm_ret;
        int i;
 
        /* Once state turn into MTK_STATE_ABORT, we need stop_streaming
        return 0;
 
 err_set_param:
-       ret = pm_runtime_put(&ctx->dev->plat_dev->dev);
-       if (ret < 0)
-               mtk_v4l2_err("pm_runtime_put fail %d", ret);
+       pm_ret = pm_runtime_put(&ctx->dev->plat_dev->dev);
+       if (pm_ret < 0)
+               mtk_v4l2_err("pm_runtime_put fail %d", pm_ret);
 
 err_start_stream:
        for (i = 0; i < q->num_buffers; ++i) {