* [PATCH v6 01/10] media: venus: Use flex array for hfi_session_release_buffer_pkt
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 21:38 ` Stanimir Varbanov
2024-08-13 12:31 ` [PATCH v6 02/10] media: venus: Refactor struct hfi_uncompressed_plane_info Ricardo Ribalda
` (8 subsequent siblings)
9 siblings, 1 reply; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
Replace the old style single element array with a flex array. We do not
allocate this structure, so the size change should not be an issue.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_cmds.h:204:5-16: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index 20acd412ee7b..42825f07939d 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -227,7 +227,7 @@ struct hfi_session_release_buffer_pkt {
u32 extradata_size;
u32 response_req;
u32 num_buffers;
- u32 buffer_info[1];
+ u32 buffer_info[];
};
struct hfi_session_release_resources_pkt {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v6 01/10] media: venus: Use flex array for hfi_session_release_buffer_pkt
2024-08-13 12:31 ` [PATCH v6 01/10] media: venus: Use flex array for hfi_session_release_buffer_pkt Ricardo Ribalda
@ 2024-08-13 21:38 ` Stanimir Varbanov
2024-08-14 11:40 ` Ricardo Ribalda
0 siblings, 1 reply; 15+ messages in thread
From: Stanimir Varbanov @ 2024-08-13 21:38 UTC (permalink / raw)
To: Ricardo Ribalda, Stanimir Varbanov, Vikash Garodia,
Bryan O'Donoghue, Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel
Hi Ricardo,
On 8/13/24 15:31, Ricardo Ribalda wrote:
> Replace the old style single element array with a flex array. We do not
> allocate this structure, so the size change should not be an issue.
>
> This fixes the following cocci warning:
> drivers/media/platform/qcom/venus/hfi_cmds.h:204:5-16: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
>
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Could you inverse the order of the tags, please. "Signed-off-by" must be
first and then the others.
All patches in the series has this issue.
~Stan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 01/10] media: venus: Use flex array for hfi_session_release_buffer_pkt
2024-08-13 21:38 ` Stanimir Varbanov
@ 2024-08-14 11:40 ` Ricardo Ribalda
0 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-14 11:40 UTC (permalink / raw)
To: Stanimir Varbanov
Cc: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-arm-msm,
linux-kernel
Hi Stan
On Tue, 13 Aug 2024 at 23:38, Stanimir Varbanov <svarbanov@suse.de> wrote:
>
> Hi Ricardo,
>
> On 8/13/24 15:31, Ricardo Ribalda wrote:
> > Replace the old style single element array with a flex array. We do not
> > allocate this structure, so the size change should not be an issue.
> >
> > This fixes the following cocci warning:
> > drivers/media/platform/qcom/venus/hfi_cmds.h:204:5-16: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
> >
> > Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
>
> Could you inverse the order of the tags, please. "Signed-off-by" must be
> first and then the others.
Just sent a v7 taking care of this.
I am almost sure that I used b4 to import the tags.... Are we sure
that this is a policy that we should follow?
Regards!
>
> All patches in the series has this issue.
>
> ~Stan
>
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v6 02/10] media: venus: Refactor struct hfi_uncompressed_plane_info
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 01/10] media: venus: Use flex array for hfi_session_release_buffer_pkt Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 03/10] media: venus: Refactor struct hfi_session_get_property_pkt Ricardo Ribalda
` (7 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
This field is never used, but if we remove it we would change the size
of the struct and can lead to behavior change. Stay on the safe side by
replacing the single element array with a single element field.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_helper.h:1003:43-60: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_helper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index e4c05d62cfc7..5e91f3f6984d 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -1005,7 +1005,7 @@ struct hfi_uncompressed_plane_constraints {
struct hfi_uncompressed_plane_info {
u32 format;
u32 num_planes;
- struct hfi_uncompressed_plane_constraints plane_constraints[1];
+ struct hfi_uncompressed_plane_constraints plane_constraints;
};
struct hfi_uncompressed_format_supported {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 03/10] media: venus: Refactor struct hfi_session_get_property_pkt
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 01/10] media: venus: Use flex array for hfi_session_release_buffer_pkt Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 02/10] media: venus: Refactor struct hfi_uncompressed_plane_info Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 04/10] media: venus: Refactor struct hfi_uncompressed_format_supported Ricardo Ribalda
` (6 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
The struct hfi_session_get_property_pkt is always used to fetch a
single property. Make that explicit in the code and avoid a single
element array at the end of the struct.
This change fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_cmds.h:194:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.c | 4 ++--
drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 3418d2dd9371..75f4a3d3e748 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -402,7 +402,7 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *pkt,
pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_GET_PROPERTY;
pkt->shdr.session_id = hash32_ptr(cookie);
pkt->num_properties = 1;
- pkt->data[0] = ptype;
+ pkt->data = ptype;
return 0;
}
@@ -1110,7 +1110,7 @@ pkt_session_get_property_3xx(struct hfi_session_get_property_pkt *pkt,
switch (ptype) {
case HFI_PROPERTY_CONFIG_VDEC_ENTROPY:
- pkt->data[0] = HFI_PROPERTY_CONFIG_VDEC_ENTROPY;
+ pkt->data = HFI_PROPERTY_CONFIG_VDEC_ENTROPY;
break;
default:
ret = pkt_session_get_property_1x(pkt, cookie, ptype);
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index 42825f07939d..b158fcd00dd6 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -217,7 +217,7 @@ struct hfi_session_resume_pkt {
struct hfi_session_get_property_pkt {
struct hfi_session_hdr_pkt shdr;
u32 num_properties;
- u32 data[1];
+ u32 data;
};
struct hfi_session_release_buffer_pkt {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 04/10] media: venus: Refactor struct hfi_uncompressed_format_supported
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (2 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 03/10] media: venus: Refactor struct hfi_session_get_property_pkt Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 05/10] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt Ricardo Ribalda
` (5 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
plane_info is not a typical array, the data is not contiguous:
pinfo = (void *)pinfo + sizeof(*constr) * num_planes +
2 * sizeof(u32);
Replace the single element array with a single element field.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_helper.h:1009:36-46: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_helper.h | 2 +-
drivers/media/platform/qcom/venus/hfi_parser.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index 5e91f3f6984d..3edefa4edeb9 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -1011,7 +1011,7 @@ struct hfi_uncompressed_plane_info {
struct hfi_uncompressed_format_supported {
u32 buffer_type;
u32 format_entries;
- struct hfi_uncompressed_plane_info plane_info[1];
+ struct hfi_uncompressed_plane_info plane_info;
};
struct hfi_uncompressed_plane_actual {
diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media/platform/qcom/venus/hfi_parser.c
index c43839539d4d..3df241dc3a11 100644
--- a/drivers/media/platform/qcom/venus/hfi_parser.c
+++ b/drivers/media/platform/qcom/venus/hfi_parser.c
@@ -157,7 +157,7 @@ static void
parse_raw_formats(struct venus_core *core, u32 codecs, u32 domain, void *data)
{
struct hfi_uncompressed_format_supported *fmt = data;
- struct hfi_uncompressed_plane_info *pinfo = fmt->plane_info;
+ struct hfi_uncompressed_plane_info *pinfo = &fmt->plane_info;
struct hfi_uncompressed_plane_constraints *constr;
struct raw_formats rawfmts[MAX_FMT_ENTRIES] = {};
u32 entries = fmt->format_entries;
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 05/10] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (3 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 04/10] media: venus: Refactor struct hfi_uncompressed_format_supported Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 06/10] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt Ricardo Ribalda
` (4 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
The single element array data[1] is never used. Replace it with a
padding field of the same size.
This fixes the following cocci error:
drivers/media/platform/qcom/venus/hfi_cmds.h:163:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index b158fcd00dd6..01f5463e0fa2 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -168,7 +168,7 @@ struct hfi_session_empty_buffer_uncompressed_plane0_pkt {
u32 input_tag;
u32 packet_buffer;
u32 extradata_buffer;
- u32 data[1];
+ u32 data;
};
struct hfi_session_empty_buffer_uncompressed_plane1_pkt {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 06/10] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (4 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 05/10] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 07/10] media: venus: Refactor hfi_sys_get_property_pkt Ricardo Ribalda
` (3 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
The single element array data[1] is never used. Replace it with a
padding field of the same size.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_cmds.h:146:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index 01f5463e0fa2..de0bf2399505 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -151,7 +151,7 @@ struct hfi_session_empty_buffer_compressed_pkt {
u32 input_tag;
u32 packet_buffer;
u32 extradata_buffer;
- u32 data[1];
+ u32 data;
};
struct hfi_session_empty_buffer_uncompressed_plane0_pkt {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 07/10] media: venus: Refactor hfi_sys_get_property_pkt
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (5 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 06/10] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 08/10] media: venus: Refactor hfi_session_fill_buffer_pkt Ricardo Ribalda
` (2 subsequent siblings)
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
Replace a single length element array with an element.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_cmds.h:77:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.c | 2 +-
drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 75f4a3d3e748..0a4de8ca1df5 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -156,7 +156,7 @@ void pkt_sys_image_version(struct hfi_sys_get_property_pkt *pkt)
pkt->hdr.size = sizeof(*pkt);
pkt->hdr.pkt_type = HFI_CMD_SYS_GET_PROPERTY;
pkt->num_properties = 1;
- pkt->data[0] = HFI_PROPERTY_SYS_IMAGE_VERSION;
+ pkt->data = HFI_PROPERTY_SYS_IMAGE_VERSION;
}
int pkt_session_init(struct hfi_session_init_pkt *pkt, void *cookie,
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index de0bf2399505..615ac8d156a5 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -74,7 +74,7 @@ struct hfi_sys_set_property_pkt {
struct hfi_sys_get_property_pkt {
struct hfi_pkt_hdr hdr;
u32 num_properties;
- u32 data[1];
+ u32 data;
};
struct hfi_sys_set_buffers_pkt {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 08/10] media: venus: Refactor hfi_session_fill_buffer_pkt
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (6 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 07/10] media: venus: Refactor hfi_sys_get_property_pkt Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 09/10] media: venus: Refactor hfi_buffer_alloc_mode_supported Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 10/10] media: venus: Convert one-element-arrays to flex-arrays Ricardo Ribalda
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
The single data array data[1] is only used to save the extradata_size.
Replace it with a single element field.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_cmds.h:175:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.c | 2 +-
drivers/media/platform/qcom/venus/hfi_cmds.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 0a4de8ca1df5..3ae063094e3e 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -331,7 +331,7 @@ int pkt_session_ftb(struct hfi_session_fill_buffer_pkt *pkt, void *cookie,
pkt->alloc_len = out_frame->alloc_len;
pkt->filled_len = out_frame->filled_len;
pkt->offset = out_frame->offset;
- pkt->data[0] = out_frame->extradata_size;
+ pkt->data = out_frame->extradata_size;
return 0;
}
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index 615ac8d156a5..63b93a34f609 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -198,7 +198,7 @@ struct hfi_session_fill_buffer_pkt {
u32 output_tag;
u32 packet_buffer;
u32 extradata_buffer;
- u32 data[1];
+ u32 data;
};
struct hfi_session_flush_pkt {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 09/10] media: venus: Refactor hfi_buffer_alloc_mode_supported
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (7 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 08/10] media: venus: Refactor hfi_session_fill_buffer_pkt Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-13 12:31 ` [PATCH v6 10/10] media: venus: Convert one-element-arrays to flex-arrays Ricardo Ribalda
9 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
Replace the old style single element array at the end of the struct with
a flex array.
The code does not allocate this structure, so the size change should not
be a problem.
This fixes the following cocci warning:
drivers/media/platform/qcom/venus/hfi_helper.h:1233:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Acked-by: Vikash Garodia <quic_vgarodia@quicinc.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_helper.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index 3edefa4edeb9..755aabcd8048 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -1264,7 +1264,7 @@ struct hfi_interlace_format_supported {
struct hfi_buffer_alloc_mode_supported {
u32 buffer_type;
u32 num_entries;
- u32 data[1];
+ u32 data[];
};
struct hfi_mb_error_map {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v6 10/10] media: venus: Convert one-element-arrays to flex-arrays
2024-08-13 12:31 [PATCH v6 00/10] media: Fix the last set of coccinelle warnings Ricardo Ribalda
` (8 preceding siblings ...)
2024-08-13 12:31 ` [PATCH v6 09/10] media: venus: Refactor hfi_buffer_alloc_mode_supported Ricardo Ribalda
@ 2024-08-13 12:31 ` Ricardo Ribalda
2024-08-14 4:41 ` Sergey Senozhatsky
9 siblings, 1 reply; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-13 12:31 UTC (permalink / raw)
To: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab
Cc: Hans Verkuil, linux-media, linux-arm-msm, linux-kernel,
Ricardo Ribalda
This structures are not used, and have a single element array at the end
of them.
This fix the following cocci warnings:
drivers/media/platform/qcom/venus/hfi_helper.h:764:5-15: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_helper.h:1041:5-15: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_helper.h:1088:39-51: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_helper.h:1093:5-22: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_helper.h:1144:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_helper.h:1239:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_helper.h:1272:4-13: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_cmds.h:85:5-16: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_cmds.h:180:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
drivers/media/platform/qcom/venus/hfi_cmds.h:189:5-9: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/platform/qcom/venus/hfi_cmds.h | 6 +++---
drivers/media/platform/qcom/venus/hfi_helper.h | 14 +++++++-------
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index 63b93a34f609..1cd1b5e2d056 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -82,7 +82,7 @@ struct hfi_sys_set_buffers_pkt {
u32 buffer_type;
u32 buffer_size;
u32 num_buffers;
- u32 buffer_addr[1];
+ u32 buffer_addr[];
};
struct hfi_sys_ping_pkt {
@@ -177,7 +177,7 @@ struct hfi_session_empty_buffer_uncompressed_plane1_pkt {
u32 filled_len;
u32 offset;
u32 packet_buffer2;
- u32 data[1];
+ u32 data;
};
struct hfi_session_empty_buffer_uncompressed_plane2_pkt {
@@ -186,7 +186,7 @@ struct hfi_session_empty_buffer_uncompressed_plane2_pkt {
u32 filled_len;
u32 offset;
u32 packet_buffer3;
- u32 data[1];
+ u32 data;
};
struct hfi_session_fill_buffer_pkt {
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index 755aabcd8048..f44059f19505 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -761,7 +761,7 @@ struct hfi_multi_stream_3x {
struct hfi_multi_view_format {
u32 views;
- u32 view_order[1];
+ u32 view_order[];
};
#define HFI_MULTI_SLICE_OFF 0x1
@@ -1038,7 +1038,7 @@ struct hfi_codec_supported {
struct hfi_properties_supported {
u32 num_properties;
- u32 properties[1];
+ u32 properties[];
};
struct hfi_max_sessions_supported {
@@ -1085,12 +1085,12 @@ struct hfi_resource_ocmem_requirement {
struct hfi_resource_ocmem_requirement_info {
u32 num_entries;
- struct hfi_resource_ocmem_requirement requirements[1];
+ struct hfi_resource_ocmem_requirement requirements[];
};
struct hfi_property_sys_image_version_info_type {
u32 string_size;
- u8 str_image_version[1];
+ u8 str_image_version[];
};
struct hfi_codec_mask_supported {
@@ -1141,7 +1141,7 @@ struct hfi_extradata_header {
u32 port_index;
u32 type;
u32 data_size;
- u8 data[1];
+ u8 data[];
};
struct hfi_batch_info {
@@ -1236,7 +1236,7 @@ static inline void hfi_bufreq_set_count_min_host(struct hfi_buffer_requirements
struct hfi_data_payload {
u32 size;
- u8 data[1];
+ u8 data[];
};
struct hfi_enable_picture {
@@ -1269,7 +1269,7 @@ struct hfi_buffer_alloc_mode_supported {
struct hfi_mb_error_map {
u32 error_map_size;
- u8 error_map[1];
+ u8 error_map[];
};
struct hfi_metadata_pass_through {
--
2.46.0.76.ge559c4bf1a-goog
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v6 10/10] media: venus: Convert one-element-arrays to flex-arrays
2024-08-13 12:31 ` [PATCH v6 10/10] media: venus: Convert one-element-arrays to flex-arrays Ricardo Ribalda
@ 2024-08-14 4:41 ` Sergey Senozhatsky
2024-08-14 8:06 ` Ricardo Ribalda
0 siblings, 1 reply; 15+ messages in thread
From: Sergey Senozhatsky @ 2024-08-14 4:41 UTC (permalink / raw)
To: Ricardo Ribalda
Cc: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-arm-msm,
linux-kernel
On (24/08/13 12:31), Ricardo Ribalda wrote:
>
> This structures are not used
>
Why not just delete them?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v6 10/10] media: venus: Convert one-element-arrays to flex-arrays
2024-08-14 4:41 ` Sergey Senozhatsky
@ 2024-08-14 8:06 ` Ricardo Ribalda
0 siblings, 0 replies; 15+ messages in thread
From: Ricardo Ribalda @ 2024-08-14 8:06 UTC (permalink / raw)
To: Sergey Senozhatsky
Cc: Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
Mauro Carvalho Chehab, Hans Verkuil, linux-media, linux-arm-msm,
linux-kernel
On Wed, 14 Aug 2024 at 06:41, Sergey Senozhatsky
<senozhatsky@chromium.org> wrote:
>
> On (24/08/13 12:31), Ricardo Ribalda wrote:
> >
> > This structures are not used
> >
>
> Why not just delete them?
Byran preferred to keep them for documentation purposes
https://lore.kernel.org/linux-media/0640d530-404d-40cf-9737-0d7468dd0177@linaro.org/T/#u
I am fine with both options.
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 15+ messages in thread