summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2021-07-14 11:13:09 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-21 12:49:51 +0200
commit5d4317abd2223eea5884f7e28d1047d5e87d4a6f (patch)
tree5a819b6b87d329012aa7a07a00f9c7c36ddc7393
parent7ec3114ec78026b132eba2c7f4b1d582fad82047 (diff)
downloadlinux-5d4317abd2223eea5884f7e28d1047d5e87d4a6f.tar.bz2
amiserial: use memset to zero serial_state
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@suse.cz> Link: https://lore.kernel.org/r/20210714091314.8292-6-jslaby@suse.cz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/amiserial.c7
1 files changed, 1 insertions, 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);