[PATCH 06/11] amiserial: use memset to zero serial_state

From: Jiri Slaby
Date: Wed Jul 14 2021 - 05:13:49 EST


Zeroing each member of struct serial_state in probe is fragile and
overly complicated. Do one memset for them all.

Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
drivers/tty/amiserial.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 68f8cee389ec..558c77653e21 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1527,13 +1527,8 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
tty_set_operations(serial_driver, &serial_ops);

state = rs_table;
+ memset(state, 0, sizeof(*state));
state->port = (int)&custom.serdatr; /* Just to give it a value */
- state->custom_divisor = 0;
- state->icount.cts = state->icount.dsr =
- state->icount.rng = state->icount.dcd = 0;
- state->icount.rx = state->icount.tx = 0;
- state->icount.frame = state->icount.parity = 0;
- state->icount.overrun = state->icount.brk = 0;
tty_port_init(&state->tport);
state->tport.ops = &amiga_port_ops;
tty_port_link_device(&state->tport, serial_driver, 0);
--
2.32.0