media: st-hva: hva-h264: use swap macro in hva_h264_encode
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Mon, 30 Oct 2017 04:18:47 +0000 (00:18 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Tue, 31 Oct 2017 11:30:21 +0000 (07:30 -0400)
Make use of the swap macro and remove unnecessary variable tmp_frame.
This makes the code easier to read and maintain.

This code was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/sti/hva/hva-h264.c

index e6f247a983c73bf1e4cc347248af51892f7d1b10..a7e5eed17adae6487307b1670f79be64535c61cd 100644 (file)
@@ -999,7 +999,6 @@ static int hva_h264_encode(struct hva_ctx *pctx, struct hva_frame *frame,
 {
        struct hva_h264_ctx *ctx = (struct hva_h264_ctx *)pctx->priv;
        struct hva_h264_task *task = (struct hva_h264_task *)ctx->task->vaddr;
-       struct hva_buffer *tmp_frame;
        u32 stuffing_bytes = 0;
        int ret = 0;
 
@@ -1023,9 +1022,7 @@ static int hva_h264_encode(struct hva_ctx *pctx, struct hva_frame *frame,
                                       &stream->bytesused);
 
        /* switch reference & reconstructed frame */
-       tmp_frame = ctx->ref_frame;
-       ctx->ref_frame = ctx->rec_frame;
-       ctx->rec_frame = tmp_frame;
+       swap(ctx->ref_frame, ctx->rec_frame);
 
        return 0;
 err: