Linux-Media Archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/18] media: Fix the last set of coccinelle warnings
@ 2024-05-07 13:18 Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters Ricardo Ribalda
                   ` (17 more replies)
  0 siblings, 18 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

With this set we are done with all the cocci warning/errors.

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
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 <ribalda@chromium.org>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 02/18] media: xilinx: Refactor struct xvip_dma Ricardo Ribalda
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

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 <ribalda@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 02/18] media: xilinx: Refactor struct xvip_dma
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 03/18] media: dvb-frontend/mxl5xx: Refactor struct MBIN_FILE_T Ricardo Ribalda
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

Replace a single element array with a single field.

The following cocci warning is fixed:
drivers/media/platform/xilinx/xilinx-dma.h:100:19-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 <ribalda@chromium.org>
---
 drivers/media/platform/xilinx/xilinx-dma.c | 4 ++--
 drivers/media/platform/xilinx/xilinx-dma.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/xilinx/xilinx-dma.c b/drivers/media/platform/xilinx/xilinx-dma.c
index a96de5d388a1..a1687b868a44 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.c
+++ b/drivers/media/platform/xilinx/xilinx-dma.c
@@ -348,8 +348,8 @@ static void xvip_dma_buffer_queue(struct vb2_buffer *vb)
 	}
 
 	dma->xt.frame_size = 1;
-	dma->sgl[0].size = dma->format.width * dma->fmtinfo->bpp;
-	dma->sgl[0].icg = dma->format.bytesperline - dma->sgl[0].size;
+	dma->sgl.size = dma->format.width * dma->fmtinfo->bpp;
+	dma->sgl.icg = dma->format.bytesperline - dma->sgl.size;
 	dma->xt.numf = dma->format.height;
 
 	desc = dmaengine_prep_interleaved_dma(dma->dma, &dma->xt, flags);
diff --git a/drivers/media/platform/xilinx/xilinx-dma.h b/drivers/media/platform/xilinx/xilinx-dma.h
index 9c6d4c18d1a9..18f77e1a7b39 100644
--- a/drivers/media/platform/xilinx/xilinx-dma.h
+++ b/drivers/media/platform/xilinx/xilinx-dma.h
@@ -97,7 +97,7 @@ struct xvip_dma {
 	struct dma_chan *dma;
 	unsigned int align;
 	struct dma_interleaved_template xt;
-	struct data_chunk sgl[1];
+	struct data_chunk sgl;
 };
 
 #define to_xvip_dma(vdev)	container_of(vdev, struct xvip_dma, video)

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 03/18] media: dvb-frontend/mxl5xx: Refactor struct MBIN_FILE_T
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 02/18] media: xilinx: Refactor struct xvip_dma Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 04/18] media: dvb-frontend/mxl5xx: Use flex array for MBIN_SEGMENT_T Ricardo Ribalda
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

Replace a single element array, with a single element field.

The following cocci warning is fixed:
drivers/media/dvb-frontends/mxl5xx_defs.h:171: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 <ribalda@chromium.org>
---
 drivers/media/dvb-frontends/mxl5xx.c      | 2 +-
 drivers/media/dvb-frontends/mxl5xx_defs.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/dvb-frontends/mxl5xx.c b/drivers/media/dvb-frontends/mxl5xx.c
index 91e9c378397c..a15c0438b07a 100644
--- a/drivers/media/dvb-frontends/mxl5xx.c
+++ b/drivers/media/dvb-frontends/mxl5xx.c
@@ -893,7 +893,7 @@ static int do_firmware_download(struct mxl *state, u8 *mbin_buffer_ptr,
 	status = write_register(state, FW_DL_SIGN_ADDR, 0);
 	if (status)
 		return status;
-	segment_ptr = (struct MBIN_SEGMENT_T *) (&mbin_ptr->data[0]);
+	segment_ptr = (struct MBIN_SEGMENT_T *)(&mbin_ptr->data);
 	for (index = 0; index < mbin_ptr->header.num_segments; index++) {
 		if (segment_ptr->header.id != MBIN_SEGMENT_HEADER_ID) {
 			dev_err(state->i2cdev, "%s: Invalid segment header ID (%c)\n",
diff --git a/drivers/media/dvb-frontends/mxl5xx_defs.h b/drivers/media/dvb-frontends/mxl5xx_defs.h
index 097271f73740..3c5d75ed8fea 100644
--- a/drivers/media/dvb-frontends/mxl5xx_defs.h
+++ b/drivers/media/dvb-frontends/mxl5xx_defs.h
@@ -168,7 +168,7 @@ struct MBIN_FILE_HEADER_T {
 
 struct MBIN_FILE_T {
 	struct MBIN_FILE_HEADER_T header;
-	u8 data[1];
+	u8 data;
 };
 
 struct MBIN_SEGMENT_HEADER_T {

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 04/18] media: dvb-frontend/mxl5xx: Use flex array for MBIN_SEGMENT_T
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (2 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 03/18] media: dvb-frontend/mxl5xx: Refactor struct MBIN_FILE_T Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 05/18] media: pci: cx18: Use flex arrays for struct cx18_scb Ricardo Ribalda
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

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 <ribalda@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 05/18] media: pci: cx18: Use flex arrays for struct cx18_scb
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (3 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 04/18] media: dvb-frontend/mxl5xx: Use flex array for MBIN_SEGMENT_T Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 06/18] media: siano: Refactor struct sms_msg_data Ricardo Ribalda
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

Replace the old-style single element array with a flexible array.
This structure does not seem to be allocated in the code, so there is no
need to change anything else.

The following cocci warning is fixed:
drivers/media/pci/cx18/cx18-scb.h:261:22-29: 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/pci/cx18/cx18-scb.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/cx18/cx18-scb.h b/drivers/media/pci/cx18/cx18-scb.h
index f7105421dd25..841edc0712ab 100644
--- a/drivers/media/pci/cx18/cx18-scb.h
+++ b/drivers/media/pci/cx18/cx18-scb.h
@@ -258,7 +258,7 @@ struct cx18_scb {
 	struct cx18_mailbox  ppu2epu_mb;
 
 	struct cx18_mdl_ack  cpu_mdl_ack[CX18_MAX_STREAMS][CX18_MAX_MDL_ACKS];
-	struct cx18_mdl_ent  cpu_mdl[1];
+	struct cx18_mdl_ent  cpu_mdl[];
 };
 
 void cx18_init_scb(struct cx18 *cx);

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 06/18] media: siano: Refactor struct sms_msg_data
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (4 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 05/18] media: pci: cx18: Use flex arrays for struct cx18_scb Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 14:31   ` Ricardo Ribalda
  2024-05-08  3:11   ` kernel test robot
  2024-05-07 13:18 ` [PATCH 07/18] media: siano: Remove unused structures Ricardo Ribalda
                   ` (11 subsequent siblings)
  17 siblings, 2 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

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 <ribalda@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 07/18] media: siano: Remove unused structures
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (5 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 06/18] media: siano: Refactor struct sms_msg_data Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 08/18] media: siano: Use flex arrays for sms_firmware Ricardo Ribalda
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

These structs are not used in the code, remove them.

This fixes the following cocci warning:

drivers/media/common/siano/smscoreapi.h:1049: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/common/siano/smscoreapi.h:1055: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 <ribalda@chromium.org>
---
 drivers/media/common/siano/smscoreapi.h | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/drivers/media/common/siano/smscoreapi.h b/drivers/media/common/siano/smscoreapi.h
index 46dc74ac9318..bc61bc8b9ea9 100644
--- a/drivers/media/common/siano/smscoreapi.h
+++ b/drivers/media/common/siano/smscoreapi.h
@@ -1042,20 +1042,6 @@ struct sms_srvm_signal_status {
 	u32 request_id;
 };
 
-struct sms_i2c_req {
-	u32	device_address; /* I2c device address */
-	u32	write_count; /* number of bytes to write */
-	u32	read_count; /* number of bytes to read */
-	u8	Data[1];
-};
-
-struct sms_i2c_res {
-	u32	status; /* non-zero value in case of failure */
-	u32	read_count; /* number of bytes read */
-	u8	Data[1];
-};
-
-
 struct smscore_config_gpio {
 #define SMS_GPIO_DIRECTION_INPUT  0
 #define SMS_GPIO_DIRECTION_OUTPUT 1

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 08/18] media: siano: Use flex arrays for sms_firmware
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (6 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 07/18] media: siano: Remove unused structures Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 09/18] media: venus: Remove unused structs Ricardo Ribalda
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

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 <ribalda@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 09/18] media: venus: Remove unused structs
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (7 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 08/18] media: siano: Use flex arrays for sms_firmware Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 10/18] media: venus: Use flex array for hfi_session_release_buffer_pkt Ricardo Ribalda
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

This structures are not used, and have a single element array at the end
of them. Remove 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   | 26 -----------------
 drivers/media/platform/qcom/venus/hfi_helper.h | 39 --------------------------
 2 files changed, 65 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.h b/drivers/media/platform/qcom/venus/hfi_cmds.h
index 20acd412ee7b..41f765eac4d9 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -77,14 +77,6 @@ struct hfi_sys_get_property_pkt {
 	u32 data[1];
 };
 
-struct hfi_sys_set_buffers_pkt {
-	struct hfi_pkt_hdr hdr;
-	u32 buffer_type;
-	u32 buffer_size;
-	u32 num_buffers;
-	u32 buffer_addr[1];
-};
-
 struct hfi_sys_ping_pkt {
 	struct hfi_pkt_hdr hdr;
 	u32 client_data;
@@ -171,24 +163,6 @@ struct hfi_session_empty_buffer_uncompressed_plane0_pkt {
 	u32 data[1];
 };
 
-struct hfi_session_empty_buffer_uncompressed_plane1_pkt {
-	u32 flags;
-	u32 alloc_len;
-	u32 filled_len;
-	u32 offset;
-	u32 packet_buffer2;
-	u32 data[1];
-};
-
-struct hfi_session_empty_buffer_uncompressed_plane2_pkt {
-	u32 flags;
-	u32 alloc_len;
-	u32 filled_len;
-	u32 offset;
-	u32 packet_buffer3;
-	u32 data[1];
-};
-
 struct hfi_session_fill_buffer_pkt {
 	struct hfi_session_hdr_pkt shdr;
 	u32 stream_id;
diff --git a/drivers/media/platform/qcom/venus/hfi_helper.h b/drivers/media/platform/qcom/venus/hfi_helper.h
index e4c05d62cfc7..7c0edef263ae 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -759,11 +759,6 @@ struct hfi_multi_stream_3x {
 	u32 enable;
 };
 
-struct hfi_multi_view_format {
-	u32 views;
-	u32 view_order[1];
-};
-
 #define HFI_MULTI_SLICE_OFF			0x1
 #define HFI_MULTI_SLICE_BY_MB_COUNT		0x2
 #define HFI_MULTI_SLICE_BY_BYTE_COUNT		0x3
@@ -1036,11 +1031,6 @@ struct hfi_codec_supported {
 	u32 enc_codecs;
 };
 
-struct hfi_properties_supported {
-	u32 num_properties;
-	u32 properties[1];
-};
-
 struct hfi_max_sessions_supported {
 	u32 max_sessions;
 };
@@ -1083,16 +1073,6 @@ struct hfi_resource_ocmem_requirement {
 	u32 size;
 };
 
-struct hfi_resource_ocmem_requirement_info {
-	u32 num_entries;
-	struct hfi_resource_ocmem_requirement requirements[1];
-};
-
-struct hfi_property_sys_image_version_info_type {
-	u32 string_size;
-	u8  str_image_version[1];
-};
-
 struct hfi_codec_mask_supported {
 	u32 codecs;
 	u32 video_domains;
@@ -1135,15 +1115,6 @@ struct hfi_index_extradata_config {
 	u32 index_extra_data_id;
 };
 
-struct hfi_extradata_header {
-	u32 size;
-	u32 version;
-	u32 port_index;
-	u32 type;
-	u32 data_size;
-	u8 data[1];
-};
-
 struct hfi_batch_info {
 	u32 input_batch_count;
 	u32 output_batch_count;
@@ -1234,11 +1205,6 @@ static inline void hfi_bufreq_set_count_min_host(struct hfi_buffer_requirements
 		req->count_min = val;
 };
 
-struct hfi_data_payload {
-	u32 size;
-	u8 data[1];
-};
-
 struct hfi_enable_picture {
 	u32 picture_type;
 };
@@ -1267,11 +1233,6 @@ struct hfi_buffer_alloc_mode_supported {
 	u32 data[1];
 };
 
-struct hfi_mb_error_map {
-	u32 error_map_size;
-	u8 error_map[1];
-};
-
 struct hfi_metadata_pass_through {
 	int enable;
 	u32 size;

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 10/18] media: venus: Use flex array for hfi_session_release_buffer_pkt
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (8 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 09/18] media: venus: Remove unused structs Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 11/18] media: venus: Refactor struct hfi_uncompressed_plane_info Ricardo Ribalda
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, 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)

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 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 11/18] media: venus: Refactor struct hfi_uncompressed_plane_info
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (9 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 10/18] media: venus: Use flex array for hfi_session_release_buffer_pkt Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 12/18] media: venus: Refactor struct hfi_session_get_property_pkt Ricardo Ribalda
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, 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)

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 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 12/18] media: venus: Refactor struct hfi_session_get_property_pkt
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (10 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 11/18] media: venus: Refactor struct hfi_uncompressed_plane_info Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 13/18] media: venus: Refactor struct hfi_uncompressed_format_supported Ricardo Ribalda
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

The struct hfi_session_get_property_pkt is always used to fectch 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)

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/platform/qcom/venus/hfi_cmds.c | 8 ++++----
 drivers/media/platform/qcom/venus/hfi_cmds.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/hfi_cmds.c b/drivers/media/platform/qcom/venus/hfi_cmds.c
index 3418d2dd9371..520ff8a587e6 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.c
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.c
@@ -401,8 +401,8 @@ static int pkt_session_get_property_1x(struct hfi_session_get_property_pkt *pkt,
 	pkt->shdr.hdr.size = sizeof(*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->one = 1;
+	pkt->data = ptype;
 
 	return 0;
 }
@@ -1106,11 +1106,11 @@ pkt_session_get_property_3xx(struct hfi_session_get_property_pkt *pkt,
 	pkt->shdr.hdr.size = sizeof(struct hfi_session_get_property_pkt);
 	pkt->shdr.hdr.pkt_type = HFI_CMD_SESSION_GET_PROPERTY;
 	pkt->shdr.session_id = hash32_ptr(cookie);
-	pkt->num_properties = 1;
+	pkt->one = 1;
 
 	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 6dff949c4402..e1dd0ea2be1a 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -190,8 +190,8 @@ struct hfi_session_resume_pkt {
 
 struct hfi_session_get_property_pkt {
 	struct hfi_session_hdr_pkt shdr;
-	u32 num_properties;
-	u32 data[1];
+	u32 one;
+	u32 data;
 };
 
 struct hfi_session_release_buffer_pkt {

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 13/18] media: venus: Refactor struct hfi_uncompressed_format_supported
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (11 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 12/18] media: venus: Refactor struct hfi_session_get_property_pkt Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 14/18] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt Ricardo Ribalda
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, 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)

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 eb0a4c64b7ef..dee439ea4d2e 100644
--- a/drivers/media/platform/qcom/venus/hfi_helper.h
+++ b/drivers/media/platform/qcom/venus/hfi_helper.h
@@ -1006,7 +1006,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.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 14/18] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (12 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 13/18] media: venus: Refactor struct hfi_uncompressed_format_supported Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 15/18] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt Ricardo Ribalda
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

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 <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 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 15/18] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (13 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 14/18] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 16/18] media: venus: Refactor hfi_sys_get_property_pkt Ricardo Ribalda
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, 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)

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 15271b3f2b49..02e9a073d0c1 100644
--- a/drivers/media/platform/qcom/venus/hfi_cmds.h
+++ b/drivers/media/platform/qcom/venus/hfi_cmds.h
@@ -143,7 +143,7 @@ struct hfi_session_empty_buffer_compressed_pkt {
 	u32 input_tag;
 	u32 packet_buffer;
 	u32 extradata_buffer;
-	u32 data[1];
+	u32 padding;
 };
 
 struct hfi_session_empty_buffer_uncompressed_plane0_pkt {

-- 
2.45.0.rc1.225.g2a3ae87e7f-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 16/18] media: venus: Refactor hfi_sys_get_property_pkt
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (14 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 15/18] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 17/18] media: venus: Refactor hfi_session_fill_buffer_pkt Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 18/18] media: venus: Refactor hfi_buffer_alloc_mode_supported Ricardo Ribalda
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, Ricardo Ribalda

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 <ribalda@chromium.org>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 17/18] media: venus: Refactor hfi_session_fill_buffer_pkt
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (15 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 16/18] media: venus: Refactor hfi_sys_get_property_pkt Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  2024-05-07 13:18 ` [PATCH 18/18] media: venus: Refactor hfi_buffer_alloc_mode_supported Ricardo Ribalda
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, 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)

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 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 18/18] media: venus: Refactor hfi_buffer_alloc_mode_supported
  2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
                   ` (16 preceding siblings ...)
  2024-05-07 13:18 ` [PATCH 17/18] media: venus: Refactor hfi_session_fill_buffer_pkt Ricardo Ribalda
@ 2024-05-07 13:18 ` Ricardo Ribalda
  17 siblings, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 13:18 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil, 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)

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 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/18] media: siano: Refactor struct sms_msg_data
  2024-05-07 13:18 ` [PATCH 06/18] media: siano: Refactor struct sms_msg_data Ricardo Ribalda
@ 2024-05-07 14:31   ` Ricardo Ribalda
  2024-05-08  3:11   ` kernel test robot
  1 sibling, 0 replies; 21+ messages in thread
From: Ricardo Ribalda @ 2024-05-07 14:31 UTC (permalink / raw
  To: Michael Tretter, Pengutronix Kernel Team, Mauro Carvalho Chehab,
	Laurent Pinchart, Michal Simek, Andy Walls, Stanimir Varbanov,
	Vikash Garodia, Bryan O'Donoghue, Bjorn Andersson,
	Konrad Dybcio
  Cc: linux-media, linux-kernel, linux-arm-kernel, linux-arm-msm,
	Hans Verkuil

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 <ribalda@chromium.org> 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 <ribalda@chromium.org>
> ---
>  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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 06/18] media: siano: Refactor struct sms_msg_data
  2024-05-07 13:18 ` [PATCH 06/18] media: siano: Refactor struct sms_msg_data Ricardo Ribalda
  2024-05-07 14:31   ` Ricardo Ribalda
@ 2024-05-08  3:11   ` kernel test robot
  1 sibling, 0 replies; 21+ messages in thread
From: kernel test robot @ 2024-05-08  3:11 UTC (permalink / raw
  To: Ricardo Ribalda, Michael Tretter, Pengutronix Kernel Team,
	Mauro Carvalho Chehab, Laurent Pinchart, Michal Simek, Andy Walls,
	Stanimir Varbanov, Vikash Garodia, Bryan O'Donoghue,
	Bjorn Andersson, Konrad Dybcio
  Cc: oe-kbuild-all, linux-media, linux-kernel, linux-arm-kernel,
	linux-arm-msm, Hans Verkuil, 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/202405081007.7eCrDhSN-lkp@intel.com/config)
compiler: clang version 19.0.0git (https://github.com/llvm/llvm-project 0ab4458df0688955620b72cc2c72a32dffad3615)
reproduce: (https://download.01.org/0day-ci/archive/20240508/202405081007.7eCrDhSN-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405081007.7eCrDhSN-lkp@intel.com/

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2024-05-08  3:12 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-07 13:18 [PATCH 00/18] media: Fix the last set of coccinelle warnings Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 01/18] media: allegro: nal-hevc: Refactor nal_hevc_sub_layer_hrd_parameters Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 02/18] media: xilinx: Refactor struct xvip_dma Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 03/18] media: dvb-frontend/mxl5xx: Refactor struct MBIN_FILE_T Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 04/18] media: dvb-frontend/mxl5xx: Use flex array for MBIN_SEGMENT_T Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 05/18] media: pci: cx18: Use flex arrays for struct cx18_scb Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 06/18] media: siano: Refactor struct sms_msg_data Ricardo Ribalda
2024-05-07 14:31   ` Ricardo Ribalda
2024-05-08  3:11   ` kernel test robot
2024-05-07 13:18 ` [PATCH 07/18] media: siano: Remove unused structures Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 08/18] media: siano: Use flex arrays for sms_firmware Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 09/18] media: venus: Remove unused structs Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 10/18] media: venus: Use flex array for hfi_session_release_buffer_pkt Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 11/18] media: venus: Refactor struct hfi_uncompressed_plane_info Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 12/18] media: venus: Refactor struct hfi_session_get_property_pkt Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 13/18] media: venus: Refactor struct hfi_uncompressed_format_supported Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 14/18] media: venus: Refactor hfi_session_empty_buffer_uncompressed_plane0_pkt Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 15/18] media: venus: Refactor hfi_session_empty_buffer_compressed_pkt Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 16/18] media: venus: Refactor hfi_sys_get_property_pkt Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 17/18] media: venus: Refactor hfi_session_fill_buffer_pkt Ricardo Ribalda
2024-05-07 13:18 ` [PATCH 18/18] media: venus: Refactor hfi_buffer_alloc_mode_supported Ricardo Ribalda

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 read-only IMAP folder(s) and NNTP newsgroup(s).