[PATCH] serial: ns16550: Fix pointer type mismatch
J. Neuschäfer via B4 Relay
devnull+j.ne.posteo.net at kernel.org
Tue Feb 18 14:39:45 CET 2025
From: "J. Neuschäfer" <j.ne at posteo.net>
serial_out_dynamic() takes a u8* addr and uses it for 8-bit or 32-bit
accesses, depending on the value of plat->reg_width. This results in a
pointer type mismatch that the compiler may even turn into an error:
drivers/serial/ns16550.c: In function ‘serial_out_dynamic’:
drivers/serial/ns16550.c:115:42: error: passing argument 1 of ‘out_be32’ from incompatible pointer type [-Wincompatible-pointer-types]
115 | out_be32(addr, value);
| ^~~~
| |
| u8 * {aka unsigned char *}
This error was observed on PowerPC.
Signed-off-by: J. Neuschäfer <j.ne at posteo.net>
---
drivers/serial/ns16550.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 042220081079382a611877aef14ab3ea4b005441..06665d1b3385d90b14c09c3f816bb01802cea2ab 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -112,9 +112,9 @@ static void serial_out_dynamic(struct ns16550_plat *plat, u8 *addr,
} else if (plat->reg_width == 4) {
if (plat->flags & NS16550_FLAG_ENDIAN) {
if (plat->flags & NS16550_FLAG_BE)
- out_be32(addr, value);
+ out_be32((u32 *)addr, value);
else
- out_le32(addr, value);
+ out_le32((u32 *)addr, value);
} else {
writel(value, addr);
}
@@ -132,9 +132,9 @@ static int serial_in_dynamic(struct ns16550_plat *plat, u8 *addr)
} else if (plat->reg_width == 4) {
if (plat->flags & NS16550_FLAG_ENDIAN) {
if (plat->flags & NS16550_FLAG_BE)
- return in_be32(addr);
+ return in_be32((u32 *)addr);
else
- return in_le32(addr);
+ return in_le32((u32 *)addr);
} else {
return readl(addr);
}
---
base-commit: 3b1c055bf9e254ab6395907779af4e2ce14bb7e6
change-id: 20250218-serial-type-86c31980cb25
Best regards,
--
J. Neuschäfer <j.ne at posteo.net>
More information about the U-Boot
mailing list