Skip to contentSkip to conversation

media: rockchip/vpu: remove an unnecessary NULL check

PATCH In review Dan Carpenter 2 participants 2 messages Jun 7, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: rockchip/vpu: remove an unnecessary NULL check

Thus the address of "&ctx->dev->variant->codec_ops[codec_mode]" can't possibly be NULL.

---
 drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c +1 -1
index 1b80a45df8fe..42f4eb0abc8a 100644
@@ -619,7 +619,7 @@ static int rockchip_vpu_start_streaming(struct vb2_queue *q,
 
 		vpu_debug(4, "Codec mode = %d\n", codec_mode);
 		ctx->codec_ops = &ctx->dev->variant->codec_ops[codec_mode];
-		if (ctx->codec_ops && ctx->codec_ops->init)
+		if (ctx->codec_ops->init)
 			ret = ctx->codec_ops->init(ctx);
 	}
 
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · On Fri, 7 Jun 2019 16:56:09 +0300 Dan Carpenter <[email protected]>…

Thus the address of "&ctx->dev->variant->codec_ops[codec_mode]" can't possibly be NULL.

Quoted 17 lines
---
 drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/media/rockchip/vpu/rockchip_vpu_v4l2.c +1 -1
index 1b80a45df8fe..42f4eb0abc8a 100644
@@ -619,7 +619,7 @@ static int rockchip_vpu_start_streaming(struct vb2_queue *q,
 
 		vpu_debug(4, "Codec mode = %d\n", codec_mode);
 		ctx->codec_ops = &ctx->dev->variant->codec_ops[codec_mode];
-		if (ctx->codec_ops && ctx->codec_ops->init)
+		if (ctx->codec_ops->init)
 			ret = ctx->codec_ops->init(ctx);
 	}