diff mbox series

[2/6] media: renesas-ceu: keep input name simple

Message ID 20230922125837.3290073-3-hverkuil-cisco@xs4all.nl
State New
Headers show
Series media: string truncate warnings: increase name fields | expand

Commit Message

Hans Verkuil Sept. 22, 2023, 12:58 p.m. UTC
Just show the Camera index as input name in VIDIOC_ENUM_INPUT,
no need to show the subdev name as well as that is meaningless for
users anyway.

This fixes this compiler warning:

drivers/media/platform/renesas/renesas-ceu.c: In function 'ceu_enum_input':
drivers/media/platform/renesas/renesas-ceu.c:1195:59: warning: '%s' directive output may be truncated writing up to 47 bytes into a region of size between 14 and 23 [-Wformat-truncation=]
 1195 |         snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
      |                                                           ^~
drivers/media/platform/renesas/renesas-ceu.c:1195:9: note: 'snprintf' output between 10 and 66 bytes into a destination of size 32
 1195 |         snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1196 |                  inp->index, ceusd->v4l2_sd->name);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Jacopo Mondi <jacopo@jmondi.org>
---
 drivers/media/pci/zoran/zoran.h              | 2 +-
 drivers/media/platform/renesas/renesas-ceu.c | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/pci/zoran/zoran.h b/drivers/media/pci/zoran/zoran.h
index 56340553b282..efbb1466595f 100644
--- a/drivers/media/pci/zoran/zoran.h
+++ b/drivers/media/pci/zoran/zoran.h
@@ -173,7 +173,7 @@  struct card_info {
 	int inputs;		/* number of video inputs */
 	struct input {
 		int muxsel;
-		char name[32];
+		char name[42];
 	} input[BUZ_MAX_INPUT];
 
 	v4l2_std_id norms;
diff --git a/drivers/media/platform/renesas/renesas-ceu.c b/drivers/media/platform/renesas/renesas-ceu.c
index ec631c6e2a57..2562b30acfb9 100644
--- a/drivers/media/platform/renesas/renesas-ceu.c
+++ b/drivers/media/platform/renesas/renesas-ceu.c
@@ -1183,17 +1183,13 @@  static int ceu_enum_input(struct file *file, void *priv,
 			  struct v4l2_input *inp)
 {
 	struct ceu_device *ceudev = video_drvdata(file);
-	struct ceu_subdev *ceusd;
 
 	if (inp->index >= ceudev->num_sd)
 		return -EINVAL;
 
-	ceusd = ceudev->subdevs[inp->index];
-
 	inp->type = V4L2_INPUT_TYPE_CAMERA;
 	inp->std = 0;
-	snprintf(inp->name, sizeof(inp->name), "Camera%u: %s",
-		 inp->index, ceusd->v4l2_sd->name);
+	snprintf(inp->name, sizeof(inp->name), "Camera %u", inp->index);
 
 	return 0;
 }