* [PATCH] media: mtk-jpeg: remove redundant initialization of variable plane_fmt
@ 2022-01-30 23:11 Colin Ian King
2022-02-02 5:00 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2022-01-30 23:11 UTC (permalink / raw)
To: Rick Chang, Bin Liu, Mauro Carvalho Chehab, Matthias Brugger,
linux-media, linux-arm-kernel, linux-mediatek
Cc: kernel-janitors, linux-kernel
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.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
index f332beb06d51..b334bbb2e682 100644
--- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
+++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
@@ -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);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] media: mtk-jpeg: remove redundant initialization of variable plane_fmt
2022-01-30 23:11 [PATCH] media: mtk-jpeg: remove redundant initialization of variable plane_fmt Colin Ian King
@ 2022-02-02 5:00 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2022-02-02 5:00 UTC (permalink / raw)
To: Colin Ian King
Cc: Rick Chang, Bin Liu, Mauro Carvalho Chehab, Matthias Brugger,
linux-media, linux-arm-kernel, linux-mediatek, kernel-janitors,
linux-kernel
On Sun, Jan 30, 2022 at 11:11:11PM +0000, Colin Ian King wrote:
> 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.
>
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---
> drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> index f332beb06d51..b334bbb2e682 100644
> --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c
> @@ -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;
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-02 5:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30 23:11 [PATCH] media: mtk-jpeg: remove redundant initialization of variable plane_fmt Colin Ian King
2022-02-02 5:00 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).