diff mbox series

[PATCHv2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation

Message ID cee8080d-ea46-432c-8241-e7ec81ef691d@xs4all.nl
State New
Headers show
Series [PATCHv2] media: cec: extron-da-hd-4k-plus: Fix Wformat-truncation | expand

Commit Message

Hans Verkuil April 1, 2025, 8:18 a.m. UTC
Change the port type to u8 so gcc8 knows that the port fits in a single
char.

drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c:1014:44: warning: 'DCEC' directive output may be truncated writing 4 bytes into a region of size between 0 and 53 [-Wformat-truncation=]

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reported-by: Ricardo Ribalda <ribalda@chromium.org>
---
 drivers/media/cec/usb/extron-da-hd-4k-plus/cec-splitter.h   | 2 +-
 .../cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c     | 2 +-
 .../cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.h     | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/cec-splitter.h b/drivers/media/cec/usb/extron-da-hd-4k-plus/cec-splitter.h
index 7422f7c5719e..fa2e02b26565 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/cec-splitter.h
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/cec-splitter.h
@@ -14,7 +14,7 @@  struct cec_splitter;
 struct cec_splitter_port {
 	struct cec_splitter *splitter;
 	struct cec_adapter *adap;
-	unsigned int port;
+	u8 port;
 	bool is_active_source;
 	bool found_sink;
 	ktime_t lost_sink_ts;
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
index cfbfc4c1b2e6..c4add8f3f8b4 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c
@@ -1692,7 +1692,7 @@  static int extron_setup_thread(void *_extron)
 			log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_TV;
 		} else {
 			snprintf(log_addrs.osd_name, sizeof(log_addrs.osd_name),
-				 "Splitter Out%u", port->port.port);
+				 "Splitter Out%u", port->port.port % 10);
 			log_addrs.log_addr_type[0] = CEC_LOG_ADDR_TYPE_PLAYBACK;
 			log_addrs.primary_device_type[0] = CEC_OP_PRIM_DEVTYPE_PLAYBACK;
 			log_addrs.all_device_types[0] = CEC_OP_ALL_DEVTYPE_PLAYBACK;
diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.h b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.h
index b79f1253ab5d..cd07e90ea32a 100644
--- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.h
+++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.h
@@ -83,9 +83,9 @@  struct extron {
 	struct serio *serio;
 	/* locks access to serio */
 	struct mutex serio_lock;
-	unsigned int num_ports;
-	unsigned int num_in_ports;
-	unsigned int num_out_ports;
+	u8 num_ports;
+	u8 num_in_ports;
+	u8 num_out_ports;
 	char unit_name[32];
 	char unit_type[64];
 	char unit_fw_version[32];