media: mtk-jpeg: remove redundant initialization of variable plane_fmt
Subsystems (3)
PATCH 1/1 media: mtk-jpeg: remove redundant initialization of variable plane_fmt
The variable plane_fmt is being initialized with a value that is never read, it is being re-assigned a new value on each iteration of a for loop. The initialization is redundant and can be removed.
--- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +1 -1
@@ -681,7 +681,7 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) {struct mtk_jpeg_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);struct mtk_jpeg_q_data *q_data =NULL ; -struct v4l2_plane_pix_format plane_fmt = {}; +struct v4l2_plane_pix_format plane_fmt;int i; q_data =mtk_jpeg_get_q_data (ctx, vb->vb2_queue->type);
Signature · 1 line
2.34.1
Quoted 14 lines · Colin Ian King
The variable
plane_fmtis being initialized with a value that is never read, it is being re-assigned a new value on each iteration of a for loop. The initialization is redundant and can be removed.Signed-off-by Colin Ian King <[email protected]>--- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +0
-0
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) · line 684
Quoted 5 lines
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +1
-1@@ -681,7 +681,7 @@ static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb) {struct mtk_jpeg_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);struct mtk_jpeg_q_data *q_data =NULL ; -struct v4l2_plane_pix_format plane_fmt = {}; +struct v4l2_plane_pix_format plane_fmt;
This one is fine, but keep in mind that the other reason people do = {} assignments is to zero out struct holes. The assignment inside the loop will not do that.
regards,
dan carpenter