]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
serial: sh-sci: Use plain struct copy in early_console_setup()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Tue, 3 Dec 2024 16:30:29 +0000 (17:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2024 15:36:17 +0000 (16:36 +0100)
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>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/e097e5c11afe5bd4c01135779c9a40e707ef6374.1733243287.git.geert+renesas@glider.be
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/sh-sci.c

index df523c74442308360c1b411b27fea32f74c48f77..1ed13ce2c295254788a419b0fe0c2f02d73c76c9 100644 (file)
@@ -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);