diff options
| author | Jiri Slaby <jirislaby@gmail.com> | 2008-02-07 03:16:44 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 11:42:34 -0500 |
| commit | f83bb2d40a879c21c5085ee8cfc426f9936901ee (patch) | |
| tree | 5085aeaafcb49a801c4a97689a80ba83e2338ebe | |
| parent | 0ecd233bb6efa9745dffc6134ceab8aba1aa030b (diff) | |
Char: mxser, simplify mxser_get_serial_info
Initialize temp structure directly with proper values without first zeroing
it and setting later as suggested by Jan.
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Jan Engelhardt <jengelh@computergmbh.de>
Reviewed-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
| -rw-r--r-- | drivers/char/mxser_new.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/char/mxser_new.c b/drivers/char/mxser_new.c index 9449fba80faa..937c101db905 100644 --- a/drivers/char/mxser_new.c +++ b/drivers/char/mxser_new.c | |||
| @@ -1168,21 +1168,18 @@ static void mxser_flush_buffer(struct tty_struct *tty) | |||
| 1168 | static int mxser_get_serial_info(struct mxser_port *info, | 1168 | static int mxser_get_serial_info(struct mxser_port *info, |
| 1169 | struct serial_struct __user *retinfo) | 1169 | struct serial_struct __user *retinfo) |
| 1170 | { | 1170 | { |
| 1171 | struct serial_struct tmp; | 1171 | struct serial_struct tmp = { |
| 1172 | 1172 | .type = info->type, | |
| 1173 | if (!retinfo) | 1173 | .line = info->tty->index, |
| 1174 | return -EFAULT; | 1174 | .port = info->ioaddr, |
| 1175 | memset(&tmp, 0, sizeof(tmp)); | 1175 | .irq = info->board->irq, |
| 1176 | tmp.type = info->type; | 1176 | .flags = info->flags, |
| 1177 | tmp.line = info->tty->index; | 1177 | .baud_base = info->baud_base, |
| 1178 | tmp.port = info->ioaddr; | 1178 | .close_delay = info->close_delay, |
| 1179 | tmp.irq = info->board->irq; | 1179 | .closing_wait = info->closing_wait, |
| 1180 | tmp.flags = info->flags; | 1180 | .custom_divisor = info->custom_divisor, |
| 1181 | tmp.baud_base = info->baud_base; | 1181 | .hub6 = 0 |
| 1182 | tmp.close_delay = info->close_delay; | 1182 | }; |
| 1183 | tmp.closing_wait = info->closing_wait; | ||
| 1184 | tmp.custom_divisor = info->custom_divisor; | ||
| 1185 | tmp.hub6 = 0; | ||
| 1186 | if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) | 1183 | if (copy_to_user(retinfo, &tmp, sizeof(*retinfo))) |
| 1187 | return -EFAULT; | 1184 | return -EFAULT; |
| 1188 | return 0; | 1185 | return 0; |
