Char: mxser, simplify mxser_get_serial_info
authorJiri Slaby <jirislaby@gmail.com>
Thu, 7 Feb 2008 08:16:44 +0000 (00:16 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 7 Feb 2008 16:42:34 +0000 (08:42 -0800)
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>
drivers/char/mxser_new.c

index 9449fba80faabd0ffd6f549925364a5d2105b390..937c101db905aef1c0b126a51286c6787f676605 100644 (file)
@@ -1168,21 +1168,18 @@ static void mxser_flush_buffer(struct tty_struct *tty)
 static int mxser_get_serial_info(struct mxser_port *info,
                struct serial_struct __user *retinfo)
 {
-       struct serial_struct tmp;
-
-       if (!retinfo)
-               return -EFAULT;
-       memset(&tmp, 0, sizeof(tmp));
-       tmp.type = info->type;
-       tmp.line = info->tty->index;
-       tmp.port = info->ioaddr;
-       tmp.irq = info->board->irq;
-       tmp.flags = info->flags;
-       tmp.baud_base = info->baud_base;
-       tmp.close_delay = info->close_delay;
-       tmp.closing_wait = info->closing_wait;
-       tmp.custom_divisor = info->custom_divisor;
-       tmp.hub6 = 0;
+       struct serial_struct tmp = {
+               .type = info->type,
+               .line = info->tty->index,
+               .port = info->ioaddr,
+               .irq = info->board->irq,
+               .flags = info->flags,
+               .baud_base = info->baud_base,
+               .close_delay = info->close_delay,
+               .closing_wait = info->closing_wait,
+               .custom_divisor = info->custom_divisor,
+               .hub6 = 0
+       };
        if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
                return -EFAULT;
        return 0;