diff mbox series

[PATCHv2,16/23] media: microchip: don't set bus_info

Message ID 20230923152107.283289-17-hverkuil-cisco@xs4all.nl (mailing list archive)
State New, archived
Headers show
Series media: fix all string truncate warnings | expand

Commit Message

Hans Verkuil Sept. 23, 2023, 3:21 p.m. UTC
Let the V4L2 core fill this in.

Fixes these compiler warnings:

drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_querycap':
drivers/media/platform/microchip/microchip-isc-base.c:486:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
  486 |                  "platform:%s", isc->v4l2_dev.name);
      |                            ^~
drivers/media/platform/microchip/microchip-isc-base.c:485:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
  485 |         snprintf(cap->bus_info, sizeof(cap->bus_info),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  486 |                  "platform:%s", isc->v4l2_dev.name);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_mc_init':
drivers/media/platform/microchip/microchip-isc-base.c:1996:76: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
 1996 |         snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
      |                                                                            ^~
drivers/media/platform/microchip/microchip-isc-base.c:1996:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
 1996 |         snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1997 |                  isc->v4l2_dev.name);
      |                  ~~~~~~~~~~~~~~~~~~~

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Eugen Hristev <eugen.hristev@collabora.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
---
 drivers/media/platform/microchip/microchip-isc-base.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Nicolas Ferre Sept. 25, 2023, 12:01 p.m. UTC | #1
On 23/09/2023 at 17:21, Hans Verkuil wrote:
> Let the V4L2 core fill this in.
> 
> Fixes these compiler warnings:
> 
> drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_querycap':
> drivers/media/platform/microchip/microchip-isc-base.c:486:28: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
>    486 |                  "platform:%s", isc->v4l2_dev.name);
>        |                            ^~
> drivers/media/platform/microchip/microchip-isc-base.c:485:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
>    485 |         snprintf(cap->bus_info, sizeof(cap->bus_info),
>        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    486 |                  "platform:%s", isc->v4l2_dev.name);
>        |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/media/platform/microchip/microchip-isc-base.c: In function 'isc_mc_init':
> drivers/media/platform/microchip/microchip-isc-base.c:1996:76: warning: '%s' directive output may be truncated writing up to 35 bytes into a region of size 23 [-Wformat-truncation=]
>   1996 |         snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
>        |                                                                            ^~
> drivers/media/platform/microchip/microchip-isc-base.c:1996:9: note: 'snprintf' output between 10 and 45 bytes into a destination of size 32
>   1996 |         snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
>        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   1997 |                  isc->v4l2_dev.name);
>        |                  ~~~~~~~~~~~~~~~~~~~
> 
> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
> Cc: Eugen Hristev <eugen.hristev@collabora.com>
> Cc: Nicolas Ferre <nicolas.ferre@microchip.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

> ---
>   drivers/media/platform/microchip/microchip-isc-base.c | 6 ------
>   1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
> index 8dbf7bc1e863..1f8528844497 100644
> --- a/drivers/media/platform/microchip/microchip-isc-base.c
> +++ b/drivers/media/platform/microchip/microchip-isc-base.c
> @@ -478,12 +478,8 @@ static const struct vb2_ops isc_vb2_ops = {
>   static int isc_querycap(struct file *file, void *priv,
>                          struct v4l2_capability *cap)
>   {
> -       struct isc_device *isc = video_drvdata(file);
> -
>          strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
>          strscpy(cap->card, "Microchip Image Sensor Controller", sizeof(cap->card));
> -       snprintf(cap->bus_info, sizeof(cap->bus_info),
> -                "platform:%s", isc->v4l2_dev.name);
> 
>          return 0;
>   }
> @@ -1993,8 +1989,6 @@ int isc_mc_init(struct isc_device *isc, u32 ver)
>          strscpy(isc->mdev.driver_name, KBUILD_MODNAME,
>                  sizeof(isc->mdev.driver_name));
>          strscpy(isc->mdev.model, match->compatible, sizeof(isc->mdev.model));
> -       snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
> -                isc->v4l2_dev.name);
>          isc->mdev.hw_revision = ver;
> 
>          media_device_init(&isc->mdev);
> --
> 2.40.1
>
diff mbox series

Patch

diff --git a/drivers/media/platform/microchip/microchip-isc-base.c b/drivers/media/platform/microchip/microchip-isc-base.c
index 8dbf7bc1e863..1f8528844497 100644
--- a/drivers/media/platform/microchip/microchip-isc-base.c
+++ b/drivers/media/platform/microchip/microchip-isc-base.c
@@ -478,12 +478,8 @@  static const struct vb2_ops isc_vb2_ops = {
 static int isc_querycap(struct file *file, void *priv,
 			struct v4l2_capability *cap)
 {
-	struct isc_device *isc = video_drvdata(file);
-
 	strscpy(cap->driver, "microchip-isc", sizeof(cap->driver));
 	strscpy(cap->card, "Microchip Image Sensor Controller", sizeof(cap->card));
-	snprintf(cap->bus_info, sizeof(cap->bus_info),
-		 "platform:%s", isc->v4l2_dev.name);
 
 	return 0;
 }
@@ -1993,8 +1989,6 @@  int isc_mc_init(struct isc_device *isc, u32 ver)
 	strscpy(isc->mdev.driver_name, KBUILD_MODNAME,
 		sizeof(isc->mdev.driver_name));
 	strscpy(isc->mdev.model, match->compatible, sizeof(isc->mdev.model));
-	snprintf(isc->mdev.bus_info, sizeof(isc->mdev.bus_info), "platform:%s",
-		 isc->v4l2_dev.name);
 	isc->mdev.hw_revision = ver;
 
 	media_device_init(&isc->mdev);