[media] s5p_mfc_opr_v5: fix smatch warnings
[linux-block.git] / drivers / media / platform / s5p-mfc / s5p_mfc_opr_v5.c
index 58ec7bb26ebc715f11b145f72149b9a4535a9297..6234e4d7059670e8aaa46859608e95aedf2c9de4 100644 (file)
@@ -228,6 +228,7 @@ static int s5p_mfc_alloc_instance_buffer_v5(struct s5p_mfc_ctx *ctx)
        ret = s5p_mfc_alloc_priv_buf(dev->mem_dev_l, &ctx->shm);
        if (ret) {
                mfc_err("Failed to allocate shared memory buffer\n");
+               s5p_mfc_release_priv_buf(dev->mem_dev_l, &ctx->ctx);
                return ret;
        }
 
@@ -262,7 +263,7 @@ static void s5p_mfc_release_dev_context_buffer_v5(struct s5p_mfc_dev *dev)
 static void s5p_mfc_write_info_v5(struct s5p_mfc_ctx *ctx, unsigned int data,
                        unsigned int ofs)
 {
-       writel(data, (ctx->shm.virt + ofs));
+       writel(data, (volatile void __iomem *)(ctx->shm.virt + ofs));
        wmb();
 }
 
@@ -270,7 +271,7 @@ static unsigned int s5p_mfc_read_info_v5(struct s5p_mfc_ctx *ctx,
                                unsigned int ofs)
 {
        rmb();
-       return readl(ctx->shm.virt + ofs);
+       return readl((volatile void __iomem *)(ctx->shm.virt + ofs));
 }
 
 static void s5p_mfc_dec_calc_dpb_size_v5(struct s5p_mfc_ctx *ctx)
@@ -377,7 +378,7 @@ static int s5p_mfc_set_dec_stream_buffer_v5(struct s5p_mfc_ctx *ctx,
 /* Set decoding frame buffer */
 static int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx)
 {
-       unsigned int frame_size, i;
+       unsigned int frame_size_lu, i;
        unsigned int frame_size_ch, frame_size_mv;
        struct s5p_mfc_dev *dev = ctx->dev;
        unsigned int dpb;
@@ -465,10 +466,10 @@ static int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx)
                        ctx->codec_mode);
                return -EINVAL;
        }
-       frame_size = ctx->luma_size;
+       frame_size_lu = ctx->luma_size;
        frame_size_ch = ctx->chroma_size;
        frame_size_mv = ctx->mv_size;
-       mfc_debug(2, "Frm size: %d ch: %d mv: %d\n", frame_size, frame_size_ch,
+       mfc_debug(2, "Frm size: %d ch: %d mv: %d\n", frame_size_lu, frame_size_ch,
                                                                frame_size_mv);
        for (i = 0; i < ctx->total_dpb_count; i++) {
                /* Bank2 */
@@ -496,7 +497,7 @@ static int s5p_mfc_set_dec_frame_buffer_v5(struct s5p_mfc_ctx *ctx)
                mfc_debug(2, "Not enough memory has been allocated\n");
                return -ENOMEM;
        }
-       s5p_mfc_write_info_v5(ctx, frame_size, ALLOC_LUMA_DPB_SIZE);
+       s5p_mfc_write_info_v5(ctx, frame_size_lu, ALLOC_LUMA_DPB_SIZE);
        s5p_mfc_write_info_v5(ctx, frame_size_ch, ALLOC_CHROMA_DPB_SIZE);
        if (ctx->codec_mode == S5P_MFC_CODEC_H264_DEC)
                s5p_mfc_write_info_v5(ctx, frame_size_mv, ALLOC_MV_SIZE);
@@ -1186,7 +1187,6 @@ static int s5p_mfc_run_dec_frame(struct s5p_mfc_ctx *ctx, int last_frame)
        struct s5p_mfc_dev *dev = ctx->dev;
        struct s5p_mfc_buf *temp_vb;
        unsigned long flags;
-       unsigned int index;
 
        if (ctx->state == MFCINST_FINISHING) {
                last_frame = MFC_DEC_LAST_FRAME;
@@ -1211,7 +1211,6 @@ static int s5p_mfc_run_dec_frame(struct s5p_mfc_ctx *ctx, int last_frame)
                vb2_dma_contig_plane_dma_addr(temp_vb->b, 0),
                ctx->consumed_stream, temp_vb->b->v4l2_planes[0].bytesused);
        spin_unlock_irqrestore(&dev->irqlock, flags);
-       index = temp_vb->b->v4l2_buf.index;
        dev->curr_ctx = ctx->num;
        s5p_mfc_clean_ctx_int_flags(ctx);
        if (temp_vb->b->v4l2_planes[0].bytesused == 0) {