if (ctx->is_enc) {
                struct vicodec_q_data *q_src;
+               int comp_sz_or_errcode;
 
                q_src = get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT);
                state->info = q_src->info;
-               ret = v4l2_fwht_encode(state, p_src, p_dst);
-               if (ret < 0)
-                       return ret;
-               vb2_set_plane_payload(&dst_vb->vb2_buf, 0, ret);
+               comp_sz_or_errcode = v4l2_fwht_encode(state, p_src, p_dst);
+               if (comp_sz_or_errcode < 0)
+                       return comp_sz_or_errcode;
+               vb2_set_plane_payload(&dst_vb->vb2_buf, 0, comp_sz_or_errcode);
        } else {
                unsigned int comp_frame_size = ntohl(ctx->state.header.size);