Skip to contentSkip to conversation

tty: serial: qcom_geni_serial: Clean up an ARRAY_SIZE() vs sizeof()

PATCH New Dan Carpenter 1 participant 1 message Jun 24, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: serial: qcom_geni_serial: Clean up an ARRAY_SIZE() vs sizeof()

The ARRAY_SIZE() is the number of elements but we want the number of bytes so sizeof() is more appropriate. Fortunately, it's the same thing here because this is an array of u8 so this doesn't change runtime.

---
 drivers/tty/serial/qcom_geni_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/qcom_geni_serial.c +1 -1
index 457c0bf8cbf8..1ed3d354e16d 100644
@@ -718,7 +718,7 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done,
 		u8 buf[sizeof(u32)];
 		int c;
 
-		memset(buf, 0, ARRAY_SIZE(buf));
+		memset(buf, 0, sizeof(buf));
 		tx_bytes = min_t(size_t, remaining, port->tx_bytes_pw);
 
 		for (c = 0; c < tx_bytes ; c++) {
Signature · 1 line
2.27.0