1

media: mediatek: vcodec: Constify struct vb2_ops

"struct vb2_ops" are not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
  18059	   3096	     16	  21171	   52b3	drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
  18171	   2968	     16	  21155	   52a3	drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateful.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Christophe JAILLET 2024-06-16 08:29:53 +02:00 committed by Hans Verkuil
parent 7878d3a385
commit 41eb4fb5d9
2 changed files with 2 additions and 2 deletions

View File

@ -595,7 +595,7 @@ static void mtk_init_vdec_params(struct mtk_vcodec_dec_ctx *ctx)
}
}
static struct vb2_ops mtk_vdec_frame_vb2_ops = {
static const struct vb2_ops mtk_vdec_frame_vb2_ops = {
.queue_setup = vb2ops_vdec_queue_setup,
.buf_prepare = vb2ops_vdec_buf_prepare,
.wait_prepare = vb2_ops_wait_prepare,

View File

@ -854,7 +854,7 @@ static int vb2ops_vdec_out_buf_validate(struct vb2_buffer *vb)
return 0;
}
static struct vb2_ops mtk_vdec_request_vb2_ops = {
static const struct vb2_ops mtk_vdec_request_vb2_ops = {
.queue_setup = vb2ops_vdec_queue_setup,
.wait_prepare = vb2_ops_wait_prepare,
.wait_finish = vb2_ops_wait_finish,