Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: sh-sci: Use plain struct copy in early_console_setup()
@ 2024-12-03 16:30 Geert Uytterhoeven
  2024-12-03 16:45 ` Claudiu Beznea
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Geert Uytterhoeven @ 2024-12-03 16:30 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby, Wolfram Sang, Claudiu Beznea,
	Lad Prabhakar
  Cc: linux-serial, linux-renesas-soc, linux-sh, Geert Uytterhoeven

Using memcpy() prevents the compiler from doing any checking on the
types of the passed pointer parameters.  Copy the structure using struct
assignment instead, to increase type-safety.

No change in generated code on all relevant architectures
(arm/arm64/riscv/sh).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/tty/serial/sh-sci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index df523c7444230836..1ed13ce2c2952547 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -3542,7 +3542,7 @@ static int __init early_console_setup(struct earlycon_device *device,
 		return -ENODEV;
 
 	device->port.type = type;
-	memcpy(&sci_ports[0].port, &device->port, sizeof(struct uart_port));
+	sci_ports[0].port = device->port;
 	port_cfg.type = type;
 	sci_ports[0].cfg = &port_cfg;
 	sci_ports[0].params = sci_probe_regmap(&port_cfg);
-- 
2.34.1


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

end of thread, other threads:[~2025-01-30  8:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-03 16:30 [PATCH] serial: sh-sci: Use plain struct copy in early_console_setup() Geert Uytterhoeven
2024-12-03 16:45 ` Claudiu Beznea
2024-12-03 16:49   ` Claudiu Beznea
2024-12-03 17:01   ` Geert Uytterhoeven
2024-12-04 11:28 ` Lad, Prabhakar
2024-12-04 16:12 ` Claudiu Beznea
2025-01-30  8:33 ` John Paul Adrian Glaubitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox