From patchwork Tue Dec 3 16:30:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 847558 Received: from andre.telenet-ops.be (andre.telenet-ops.be [195.130.132.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F1BF1F8AD8 for ; Tue, 3 Dec 2024 16:30:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.130.132.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733243435; cv=none; b=XalItLn20AhdNS7CnSMX1LYpfX//SkipdN5g92Kx43SCegqkxRbd3q5xOOi/xVwhlWqY0k/NcIEo9eIhiTCa+XDTTjCCRzq3UGj1WLpxKn2ICgHTmNz14726R1dp7IfXykWSy+hSHkN4phv4dAeSOdXOT/wM3K1XAtMaa6OEv9k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733243435; c=relaxed/simple; bh=efEEoBOf2SwuQHLH5bISaYZP/7dimPAqaCuzSBuWbsA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Xlw4XOltmfluP9O4J5SojeizYFtBUcbPrNoa++nGL8zFEPEMUkpV7wv7Hu6+S/I1qfUlJIMBYTVmIWQFEDBqzgkAWKj98BjPA77/rHDqxrIOcgWEGHE6ZXxz1hgVxA/P3DItOnAHFsBWNI22CcUCx1A6JcDnXAFR3au0N76B1oQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be; spf=none smtp.mailfrom=linux-m68k.org; arc=none smtp.client-ip=195.130.132.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=glider.be Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux-m68k.org Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed80:829d:a1e7:5b32:5d8e]) by andre.telenet-ops.be with cmsmtp id kGWX2D0053sLyzB01GWXK5; Tue, 03 Dec 2024 17:30:31 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1tIVnD-000DVo-33; Tue, 03 Dec 2024 17:30:31 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1tIVnC-00AXTD-W2; Tue, 03 Dec 2024 17:30:30 +0100 From: Geert Uytterhoeven To: Greg Kroah-Hartman , Jiri Slaby , Wolfram Sang , Claudiu Beznea , Lad Prabhakar Cc: linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] serial: sh-sci: Use plain struct copy in early_console_setup() Date: Tue, 3 Dec 2024 17:30:29 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 Tested-by: Claudiu Beznea Reviewed-by: Claudiu Beznea --- 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);