With this set we are done with all the cocci warning/errors.
Signed-off-by: Ricardo Ribalda <[email protected]>
---
Ricardo Ribalda (18):
media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters
media: xilinx: Refactor struct xvip_dma
media: dvb-frontend/mxl5xx: Refactor struct MBIN_FILE_T
media: dvb-frontend/mxl5xx: Use flex array for MBIN_SEGMENT_T
media: pci: cx18: Use flex arrays for struct cx18_scb
media: siano: Refactor struct sms_msg_data
media: siano: Remove unused structures
media: siano: Use flex arrays for sms_firmware
media: venus: Remove unused structs
media: venus: Use flex array for hfi_session_release_buffer_pkt
media: venus: Refactor struct hfi_uncompressed_plane_info
media: venus: Refactor struct hfi_session_get_property_pkt
media: venus: Refactor struct hfi_uncompressed_format_supported
media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt
media: venus: Refactor hfi_session_empty_buffer_compressed_pkt
media: venus: Refactor hfi_sys_get_property_pkt
media: venus: Refactor hfi_session_fill_buffer_pkt
media: venus: Refactor hfi_buffer_alloc_mode_supported
drivers/media/common/siano/smscoreapi.c | 10 ++---
drivers/media/common/siano/smscoreapi.h | 18 +--------
drivers/media/common/siano/smsdvb-main.c | 4 +-
drivers/media/dvb-frontends/mxl5xx.c | 2 +-
drivers/media/dvb-frontends/mxl5xx_defs.h | 4 +-
drivers/media/pci/cx18/cx18-scb.h | 2 +-
drivers/media/platform/allegro-dvt/allegro-core.c | 6 +--
drivers/media/platform/allegro-dvt/nal-hevc.c | 11 ++----
drivers/media/platform/allegro-dvt/nal-hevc.h | 6 +--
drivers/media/platform/qcom/venus/hfi_cmds.c | 16 ++++----
drivers/media/platform/qcom/venus/hfi_cmds.h | 46 +++++------------------
drivers/media/platform/qcom/venus/hfi_helper.h | 45 ++--------------------
drivers/media/platform/qcom/venus/hfi_parser.c | 2 +-
drivers/media/platform/qcom/venus/hfi_venus.c | 2 +-
drivers/media/platform/xilinx/xilinx-dma.c | 4 +-
drivers/media/platform/xilinx/xilinx-dma.h | 2 +-
16 files changed, 48 insertions(+), 132 deletions(-)
---
base-commit: e695668af8523b059127dfa8b261c76e7c9cde10
change-id: 20240507-cocci-flexarray-9a807a8e108e
Best regards,
--
Ricardo Ribalda <[email protected]>
This struct was only used to get the version from the core. Make that
explicit.
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)
Signed-off-by: Ricardo Ribalda <[email protected]>
---
drivers/media/platform/qcom/venus/hfi_cmds.c | 6 +++---
drivers/media/platform/qcom/venus/hfi_cmds.h | 8 ++++----
drivers/media/platform/qcom/venus/hfi_venus.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 520ff8a587e6..c5123f2e76fe 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -151,12 +151,12 @@ int pkt_sys_ssr_cmd(struct hfi_sys_test_ssr_pkt *pkt, u32 trigger_type)
return 0;
}
-void pkt_sys_image_version(struct hfi_sys_get_property_pkt *pkt)
+void pkt_sys_image_version(struct hfi_sys_get_version_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->one = 1;
+ pkt->version = 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 02e9a073d0c1..cd7902743f62 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -71,10 +71,10 @@ struct hfi_sys_set_property_pkt {
u32 data[];
};
-struct hfi_sys_get_property_pkt {
+struct hfi_sys_get_version_pkt {
struct hfi_pkt_hdr hdr;
- u32 num_properties;
- u32 data[1];
+ u32 one;
+ u32 version;
};
struct hfi_sys_ping_pkt {
@@ -239,7 +239,7 @@ void pkt_sys_debug_config(struct hfi_sys_set_property_pkt *pkt, u32 mode,
u32 config);
void pkt_sys_coverage_config(struct hfi_sys_set_property_pkt *pkt, u32 mode);
void pkt_sys_ping(struct hfi_sys_ping_pkt *pkt, u32 cookie);
-void pkt_sys_image_version(struct hfi_sys_get_property_pkt *pkt);
+void pkt_sys_image_version(struct hfi_sys_get_version_pkt *pkt);
int pkt_sys_ssr_cmd(struct hfi_sys_test_ssr_pkt *pkt, u32 trigger_type);
int pkt_session_init(struct hfi_session_init_pkt *pkt, void *cookie,
u32 session_type, u32 codec);
diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c
index f9437b6412b9..745c2c0c0d55 100644
--- a/drivers/media/platform/qcom/venus/hfi_venus.c
+++ b/drivers/media/platform/qcom/venus/hfi_venus.c
@@ -1142,7 +1142,7 @@ static int venus_core_init(struct venus_core *core)
{
struct venus_hfi_device *hdev = to_hfi_priv(core);
struct device *dev = core->dev;
- struct hfi_sys_get_property_pkt version_pkt;
+ struct hfi_sys_get_version_pkt version_pkt;
struct hfi_sys_init_pkt pkt;
int ret;
--
2.45.0.rc1.225.g2a3ae87e7f-goog
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)
Signed-off-by: Ricardo Ribalda <[email protected]>
---
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 c5123f2e76fe..35423e211ddd 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->extradata_size = 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 cd7902743f62..0ccc4102ac3d 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -172,7 +172,7 @@ struct hfi_session_fill_buffer_pkt {
u32 output_tag;
u32 packet_buffer;
u32 extradata_buffer;
- u32 data[1];
+ u32 extradata_size;
};
struct hfi_session_flush_pkt {
--
2.45.0.rc1.225.g2a3ae87e7f-goog
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)
Signed-off-by: Ricardo Ribalda <[email protected]>
---
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 dee439ea4d2e..9545c964a428 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -1230,7 +1230,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_metadata_pass_through {
--
2.45.0.rc1.225.g2a3ae87e7f-goog
Replace old style single array member, with flex array.
The struct is allocated, but it seems like there was an over allocation
error:
fw_buf = kmalloc(ALIGN(fw->size + sizeof(struct sms_firmware),
SMS_ALLOC_ALIGNMENT), GFP_KERNEL | coredev->gfp_buf_flags);
This change fixes this cocci warning:
drivers/media/common/siano/smscoreapi.h:669:6-13: 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 <[email protected]>
---
drivers/media/common/siano/smscoreapi.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h
index bc61bc8b9ea9..82d9f8a64d99 100644
--- a/drivers/media/common/siano/smscoreapi.h
+++ b/drivers/media/common/siano/smscoreapi.h
@@ -666,7 +666,7 @@ struct sms_firmware {
u32 check_sum;
u32 length;
u32 start_address;
- u8 payload[1];
+ u8 payload[];
};
/* statistics information returned as response for
--
2.45.0.rc1.225.g2a3ae87e7f-goog
Replace a single element array with a single element field.
This fixes the following cocci warning:
drivers/media/common/siano/smscoreapi.h:619:5-13: 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 <[email protected]>
---
drivers/media/common/siano/smscoreapi.c | 10 +++++-----
drivers/media/common/siano/smscoreapi.h | 2 +-
drivers/media/common/siano/smsdvb-main.c | 4 ++--
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c
index 7ebcb10126c9..b6f1eb5dbbdf 100644
--- a/drivers/media/common/siano/smscoreapi.c
+++ b/drivers/media/common/siano/smscoreapi.c
@@ -839,7 +839,7 @@ static int smscore_configure_board(struct smscore_device_t *coredev)
mtu_msg.x_msg_header.msg_flags = 0;
mtu_msg.x_msg_header.msg_type = MSG_SMS_SET_MAX_TX_MSG_LEN_REQ;
mtu_msg.x_msg_header.msg_length = sizeof(mtu_msg);
- mtu_msg.msg_data[0] = board->mtu;
+ mtu_msg.msg_data = board->mtu;
coredev->sendrequest_handler(coredev->context, &mtu_msg,
sizeof(mtu_msg));
@@ -852,7 +852,7 @@ static int smscore_configure_board(struct smscore_device_t *coredev)
SMS_INIT_MSG(&crys_msg.x_msg_header,
MSG_SMS_NEW_CRYSTAL_REQ,
sizeof(crys_msg));
- crys_msg.msg_data[0] = board->crystal;
+ crys_msg.msg_data = board->crystal;
coredev->sendrequest_handler(coredev->context, &crys_msg,
sizeof(crys_msg));
@@ -1306,7 +1306,7 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)
msg = (struct sms_msg_data *)SMS_ALIGN_ADDRESS(buffer);
SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
sizeof(struct sms_msg_data));
- msg->msg_data[0] = mode;
+ msg->msg_data = mode;
rc = smscore_sendrequest_and_wait(coredev, msg,
msg->x_msg_header. msg_length,
@@ -1394,7 +1394,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
sizeof(struct sms_msg_data));
- msg->msg_data[0] = mode;
+ msg->msg_data = mode;
rc = smscore_sendrequest_and_wait(
coredev, msg, msg->x_msg_header.msg_length,
@@ -1554,7 +1554,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
struct sms_msg_data *validity = (struct sms_msg_data *) phdr;
pr_debug("MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x\n",
- validity->msg_data[0]);
+ validity->msg_data);
complete(&coredev->data_validity_done);
break;
}
diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h
index f8789ee0d554..46dc74ac9318 100644
--- a/drivers/media/common/siano/smscoreapi.h
+++ b/drivers/media/common/siano/smscoreapi.h
@@ -616,7 +616,7 @@ struct sms_msg_hdr {
struct sms_msg_data {
struct sms_msg_hdr x_msg_header;
- u32 msg_data[1];
+ u32 msg_data;
};
struct sms_msg_data2 {
diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
index d893a0e4672b..44d8fe8b220e 100644
--- a/drivers/media/common/siano/smsdvb-main.c
+++ b/drivers/media/common/siano/smsdvb-main.c
@@ -689,7 +689,7 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed)
pid_msg.x_msg_header.msg_flags = 0;
pid_msg.x_msg_header.msg_type = MSG_SMS_ADD_PID_FILTER_REQ;
pid_msg.x_msg_header.msg_length = sizeof(pid_msg);
- pid_msg.msg_data[0] = feed->pid;
+ pid_msg.msg_data = feed->pid;
return smsclient_sendrequest(client->smsclient,
&pid_msg, sizeof(pid_msg));
@@ -711,7 +711,7 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed)
pid_msg.x_msg_header.msg_flags = 0;
pid_msg.x_msg_header.msg_type = MSG_SMS_REMOVE_PID_FILTER_REQ;
pid_msg.x_msg_header.msg_length = sizeof(pid_msg);
- pid_msg.msg_data[0] = feed->pid;
+ pid_msg.msg_data = feed->pid;
return smsclient_sendrequest(client->smsclient,
&pid_msg, sizeof(pid_msg));
--
2.45.0.rc1.225.g2a3ae87e7f-goog
The single element array data[1] is never used. Replace it whit 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)
Signed-off-by: Ricardo Ribalda <[email protected]>
---
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 e1dd0ea2be1a..15271b3f2b49 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -160,7 +160,7 @@ struct hfi_session_empty_buffer_uncompressed_plane0_pkt {
u32 input_tag;
u32 packet_buffer;
u32 extradata_buffer;
- u32 data[1];
+ u32 padding;
};
struct hfi_session_fill_buffer_pkt {
--
2.45.0.rc1.225.g2a3ae87e7f-goog
Replace the older style one-element array with a flexible array member.
There does not seem to be any allocation for this struct in the code, so
no more code changes are required.
The following cocci warning is fixed:
drivers/media/dvb-frontends/mxl5xx_defs.h:182:4-8: 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 <[email protected]>
---
drivers/media/dvb-frontends/mxl5xx_defs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/dvb-frontends/mxl5xx_defs.h b/drivers/media/dvb-frontends/mxl5xx_defs.h
index 3c5d75ed8fea..512ec979f96f 100644
--- a/drivers/media/dvb-frontends/mxl5xx_defs.h
+++ b/drivers/media/dvb-frontends/mxl5xx_defs.h
@@ -179,7 +179,7 @@ struct MBIN_SEGMENT_HEADER_T {
struct MBIN_SEGMENT_T {
struct MBIN_SEGMENT_HEADER_T header;
- u8 data[1];
+ u8 data[];
};
enum MXL_CMD_TYPE_E { MXL_CMD_WRITE = 0, MXL_CMD_READ };
--
2.45.0.rc1.225.g2a3ae87e7f-goog
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)
Signed-off-by: Ricardo Ribalda <[email protected]>
---
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 41f765eac4d9..6dff949c4402 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -201,7 +201,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.45.0.rc1.225.g2a3ae87e7f-goog
Replace all the single elements arrays with the element itself.
Pahole shows the same padding and alignment for x86 and arm in both
situations.
This fixes this cocci warning:
drivers/media/platform/allegro-dvt/nal-hevc.h:102:14-22: 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 <[email protected]>
---
drivers/media/platform/allegro-dvt/allegro-core.c | 6 +++---
drivers/media/platform/allegro-dvt/nal-hevc.c | 11 +++--------
drivers/media/platform/allegro-dvt/nal-hevc.h | 6 +++---
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c
index da61f9beb6b4..369bd88cc0ae 100644
--- a/drivers/media/platform/allegro-dvt/allegro-core.c
+++ b/drivers/media/platform/allegro-dvt/allegro-core.c
@@ -1852,14 +1852,14 @@ static ssize_t allegro_hevc_write_sps(struct allegro_channel *channel,
hrd->dpb_output_delay_length_minus1 = 30;
hrd->bit_rate_scale = ffs(channel->bitrate_peak) - 6;
- hrd->vcl_hrd[0].bit_rate_value_minus1[0] =
+ hrd->vcl_hrd[0].bit_rate_value_minus1 =
(channel->bitrate_peak >> (6 + hrd->bit_rate_scale)) - 1;
cpb_size = v4l2_ctrl_g_ctrl(channel->mpeg_video_cpb_size) * 1000;
hrd->cpb_size_scale = ffs(cpb_size) - 4;
- hrd->vcl_hrd[0].cpb_size_value_minus1[0] = (cpb_size >> (4 + hrd->cpb_size_scale)) - 1;
+ hrd->vcl_hrd[0].cpb_size_value_minus1 = (cpb_size >> (4 + hrd->cpb_size_scale)) - 1;
- hrd->vcl_hrd[0].cbr_flag[0] = !v4l2_ctrl_g_ctrl(channel->mpeg_video_frame_rc_enable);
+ hrd->vcl_hrd[0].cbr_flag = !v4l2_ctrl_g_ctrl(channel->mpeg_video_frame_rc_enable);
size = nal_hevc_write_sps(&dev->plat_dev->dev, dest, n, sps);
diff --git a/drivers/media/platform/allegro-dvt/nal-hevc.c b/drivers/media/platform/allegro-dvt/nal-hevc.c
index 9cdf2756e0a3..575089522df5 100644
--- a/drivers/media/platform/allegro-dvt/nal-hevc.c
+++ b/drivers/media/platform/allegro-dvt/nal-hevc.c
@@ -210,14 +210,9 @@ static void nal_hevc_rbsp_vps(struct rbsp *rbsp, struct nal_hevc_vps *vps)
static void nal_hevc_rbsp_sub_layer_hrd_parameters(struct rbsp *rbsp,
struct nal_hevc_sub_layer_hrd_parameters *hrd)
{
- unsigned int i;
- unsigned int cpb_cnt = 1;
-
- for (i = 0; i < cpb_cnt; i++) {
- rbsp_uev(rbsp, &hrd->bit_rate_value_minus1[i]);
- rbsp_uev(rbsp, &hrd->cpb_size_value_minus1[i]);
- rbsp_bit(rbsp, &hrd->cbr_flag[i]);
- }
+ rbsp_uev(rbsp, &hrd->bit_rate_value_minus1);
+ rbsp_uev(rbsp, &hrd->cpb_size_value_minus1);
+ rbsp_bit(rbsp, &hrd->cbr_flag);
}
static void nal_hevc_rbsp_hrd_parameters(struct rbsp *rbsp,
diff --git a/drivers/media/platform/allegro-dvt/nal-hevc.h b/drivers/media/platform/allegro-dvt/nal-hevc.h
index eb46f12aae80..afa7a9d7d654 100644
--- a/drivers/media/platform/allegro-dvt/nal-hevc.h
+++ b/drivers/media/platform/allegro-dvt/nal-hevc.h
@@ -97,9 +97,9 @@ struct nal_hevc_vps {
};
struct nal_hevc_sub_layer_hrd_parameters {
- unsigned int bit_rate_value_minus1[1];
- unsigned int cpb_size_value_minus1[1];
- unsigned int cbr_flag[1];
+ unsigned int bit_rate_value_minus1;
+ unsigned int cpb_size_value_minus1;
+ unsigned int cbr_flag;
};
struct nal_hevc_hrd_parameters {
--
2.45.0.rc1.225.g2a3ae87e7f-goog
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)
Signed-off-by: Ricardo Ribalda <[email protected]>
---
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 7c0edef263ae..eb0a4c64b7ef 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -1000,7 +1000,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.45.0.rc1.225.g2a3ae87e7f-goog
Hi,
The CI has found a build error in ppc for this patch.
https://gitlab.freedesktop.org/linux-media/media-staging/-/pipelines/1171798/test_report?job_name=build
Will send a v2 shortly
On Tue, 7 May 2024 at 15:18, Ricardo Ribalda <[email protected]> wrote:
>
> Replace a single element array with a single element field.
>
> This fixes the following cocci warning:
> drivers/media/common/siano/smscoreapi.h:619:5-13: 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 <[email protected]>
> ---
> drivers/media/common/siano/smscoreapi.c | 10 +++++-----
> drivers/media/common/siano/smscoreapi.h | 2 +-
> drivers/media/common/siano/smsdvb-main.c | 4 ++--
> 3 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c
> index 7ebcb10126c9..b6f1eb5dbbdf 100644
> --- a/drivers/media/common/siano/smscoreapi.c
> +++ b/drivers/media/common/siano/smscoreapi.c
> @@ -839,7 +839,7 @@ static int smscore_configure_board(struct smscore_device_t *coredev)
> mtu_msg.x_msg_header.msg_flags = 0;
> mtu_msg.x_msg_header.msg_type = MSG_SMS_SET_MAX_TX_MSG_LEN_REQ;
> mtu_msg.x_msg_header.msg_length = sizeof(mtu_msg);
> - mtu_msg.msg_data[0] = board->mtu;
> + mtu_msg.msg_data = board->mtu;
>
> coredev->sendrequest_handler(coredev->context, &mtu_msg,
> sizeof(mtu_msg));
> @@ -852,7 +852,7 @@ static int smscore_configure_board(struct smscore_device_t *coredev)
> SMS_INIT_MSG(&crys_msg.x_msg_header,
> MSG_SMS_NEW_CRYSTAL_REQ,
> sizeof(crys_msg));
> - crys_msg.msg_data[0] = board->crystal;
> + crys_msg.msg_data = board->crystal;
>
> coredev->sendrequest_handler(coredev->context, &crys_msg,
> sizeof(crys_msg));
> @@ -1306,7 +1306,7 @@ static int smscore_init_device(struct smscore_device_t *coredev, int mode)
> msg = (struct sms_msg_data *)SMS_ALIGN_ADDRESS(buffer);
> SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
> sizeof(struct sms_msg_data));
> - msg->msg_data[0] = mode;
> + msg->msg_data = mode;
>
> rc = smscore_sendrequest_and_wait(coredev, msg,
> msg->x_msg_header. msg_length,
> @@ -1394,7 +1394,7 @@ int smscore_set_device_mode(struct smscore_device_t *coredev, int mode)
>
> SMS_INIT_MSG(&msg->x_msg_header, MSG_SMS_INIT_DEVICE_REQ,
> sizeof(struct sms_msg_data));
> - msg->msg_data[0] = mode;
> + msg->msg_data = mode;
>
> rc = smscore_sendrequest_and_wait(
> coredev, msg, msg->x_msg_header.msg_length,
> @@ -1554,7 +1554,7 @@ void smscore_onresponse(struct smscore_device_t *coredev,
> struct sms_msg_data *validity = (struct sms_msg_data *) phdr;
>
> pr_debug("MSG_SMS_DATA_VALIDITY_RES, checksum = 0x%x\n",
> - validity->msg_data[0]);
> + validity->msg_data);
> complete(&coredev->data_validity_done);
> break;
> }
> diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h
> index f8789ee0d554..46dc74ac9318 100644
> --- a/drivers/media/common/siano/smscoreapi.h
> +++ b/drivers/media/common/siano/smscoreapi.h
> @@ -616,7 +616,7 @@ struct sms_msg_hdr {
>
> struct sms_msg_data {
> struct sms_msg_hdr x_msg_header;
> - u32 msg_data[1];
> + u32 msg_data;
> };
>
> struct sms_msg_data2 {
> diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c
> index d893a0e4672b..44d8fe8b220e 100644
> --- a/drivers/media/common/siano/smsdvb-main.c
> +++ b/drivers/media/common/siano/smsdvb-main.c
> @@ -689,7 +689,7 @@ static int smsdvb_start_feed(struct dvb_demux_feed *feed)
> pid_msg.x_msg_header.msg_flags = 0;
> pid_msg.x_msg_header.msg_type = MSG_SMS_ADD_PID_FILTER_REQ;
> pid_msg.x_msg_header.msg_length = sizeof(pid_msg);
> - pid_msg.msg_data[0] = feed->pid;
> + pid_msg.msg_data = feed->pid;
>
> return smsclient_sendrequest(client->smsclient,
> &pid_msg, sizeof(pid_msg));
> @@ -711,7 +711,7 @@ static int smsdvb_stop_feed(struct dvb_demux_feed *feed)
> pid_msg.x_msg_header.msg_flags = 0;
> pid_msg.x_msg_header.msg_type = MSG_SMS_REMOVE_PID_FILTER_REQ;
> pid_msg.x_msg_header.msg_length = sizeof(pid_msg);
> - pid_msg.msg_data[0] = feed->pid;
> + pid_msg.msg_data = feed->pid;
>
> return smsclient_sendrequest(client->smsclient,
> &pid_msg, sizeof(pid_msg));
>
> --
> 2.45.0.rc1.225.g2a3ae87e7f-goog
>
--
Ricardo Ribalda
Hi Ricardo,
kernel test robot noticed the following build errors:
[auto build test ERROR on e695668af8523b059127dfa8b261c76e7c9cde10]
url: https://github.com/intel-lab-lkp/linux/commits/Ricardo-Ribalda/media-allegro-nal-hevc-Refactor-nal_hevc_sub_layer_hrd_parameters/20240507-213119
base: e695668af8523b059127dfa8b261c76e7c9cde10
patch link: https://lore.kernel.org/r/20240507-cocci-flexarray-v1-6-4a421c21fd06%40chromium.org
patch subject: [PATCH 06/18] media: siano: Refactor struct sms_msg_data
config: mips-randconfig-r113-20240508 (https://download.01.org/0day-ci/archive/20240508/[email protected]/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 0ab4458df0688955620b72cc2c72a32dffad3615)
reproduce: (https://download.01.org/0day-ci/archive/20240508/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
In file included from drivers/media/common/siano/smsendian.c:15:
In file included from drivers/media/common/siano/smscoreapi.h:18:
In file included from include/linux/mm.h:2208:
include/linux/vmstat.h:522:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
522 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/media/common/siano/smsendian.c:27:16: error: subscripted value is not an array, pointer, or vector
27 | msg->msg_data[0] = le32_to_cpu((__force __le32)(msg->msg_data[0]));
| ~~~~~~~~~~~~~^~
drivers/media/common/siano/smsendian.c:27:64: error: subscripted value is not an array, pointer, or vector
27 | msg->msg_data[0] = le32_to_cpu((__force __le32)(msg->msg_data[0]));
| ~~~~~~~~~~~~~^~
include/linux/byteorder/generic.h:89:21: note: expanded from macro 'le32_to_cpu'
89 | #define le32_to_cpu __le32_to_cpu
| ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
drivers/media/common/siano/smsendian.c:36:17: error: subscripted value is not an array, pointer, or vector
36 | msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
| ~~~~~~~~~~~~~^~
drivers/media/common/siano/smsendian.c:36:64: error: subscripted value is not an array, pointer, or vector
36 | msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
| ~~~~~~~~~~~~~^~
include/linux/byteorder/generic.h:89:21: note: expanded from macro 'le32_to_cpu'
89 | #define le32_to_cpu __le32_to_cpu
| ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
drivers/media/common/siano/smsendian.c:73:17: error: subscripted value is not an array, pointer, or vector
73 | msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
| ~~~~~~~~~~~~~^~
drivers/media/common/siano/smsendian.c:73:64: error: subscripted value is not an array, pointer, or vector
73 | msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
| ~~~~~~~~~~~~~^~
include/linux/byteorder/generic.h:89:21: note: expanded from macro 'le32_to_cpu'
89 | #define le32_to_cpu __le32_to_cpu
| ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
1 warning and 6 errors generated.
vim +27 drivers/media/common/siano/smsendian.c
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 13
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 14 #include "smsendian.h"
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 @15 #include "smscoreapi.h"
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 16
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 17 void smsendian_handle_tx_message(void *buffer)
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 18 {
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 19 #ifdef __BIG_ENDIAN
ff7ff3656465f7 drivers/media/common/siano/smsendian.c Dong Chuanjian 2022-12-26 20 struct sms_msg_data *msg = buffer;
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 21 int i;
28a59df4d7cb8f drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2013-03-21 22 int msg_words;
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 23
dfef84fc135832 drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2013-03-21 24 switch (msg->x_msg_header.msg_type) {
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 25 case MSG_SMS_DATA_DOWNLOAD_REQ:
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 26 {
e1b7f11b37def5 drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2018-04-20 @27 msg->msg_data[0] = le32_to_cpu((__force __le32)(msg->msg_data[0]));
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 28 break;
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 29 }
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 30
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 31 default:
28a59df4d7cb8f drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2013-03-21 32 msg_words = (msg->x_msg_header.msg_length -
dfef84fc135832 drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2013-03-21 33 sizeof(struct sms_msg_hdr))/4;
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 34
28a59df4d7cb8f drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2013-03-21 35 for (i = 0; i < msg_words; i++)
e1b7f11b37def5 drivers/media/common/siano/smsendian.c Mauro Carvalho Chehab 2018-04-20 36 msg->msg_data[i] = le32_to_cpu((__force __le32)msg->msg_data[i]);
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 37
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 38 break;
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 39 }
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 40 #endif /* __BIG_ENDIAN */
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 41 }
2c5582e58ce298 drivers/media/dvb/siano/smsendian.c Mauro Carvalho Chehab 2009-05-14 42 EXPORT_SYMBOL_GPL(smsendian_handle_tx_message);
cb17f9047d2c6f drivers/media/dvb/siano/smsendian.c Uri Shkolnik 2009-04-20 43
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki