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>
This commit is contained in:
committed by
Linus Torvalds
parent
0ecd233bb6
commit
f83bb2d40a
@@ -1168,21 +1168,18 @@ static void mxser_flush_buffer(struct tty_struct *tty)
|
|||||||
static int mxser_get_serial_info(struct mxser_port *info,
|
static int mxser_get_serial_info(struct mxser_port *info,
|
||||||
struct serial_struct __user *retinfo)
|
struct serial_struct __user *retinfo)
|
||||||
{
|
{
|
||||||
struct serial_struct tmp;
|
struct serial_struct tmp = {
|
||||||
|
.type = info->type,
|
||||||
if (!retinfo)
|
.line = info->tty->index,
|
||||||
return -EFAULT;
|
.port = info->ioaddr,
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
.irq = info->board->irq,
|
||||||
tmp.type = info->type;
|
.flags = info->flags,
|
||||||
tmp.line = info->tty->index;
|
.baud_base = info->baud_base,
|
||||||
tmp.port = info->ioaddr;
|
.close_delay = info->close_delay,
|
||||||
tmp.irq = info->board->irq;
|
.closing_wait = info->closing_wait,
|
||||||
tmp.flags = info->flags;
|
.custom_divisor = info->custom_divisor,
|
||||||
tmp.baud_base = info->baud_base;
|
.hub6 = 0
|
||||||
tmp.close_delay = info->close_delay;
|
};
|
||||||
tmp.closing_wait = info->closing_wait;
|
|
||||||
tmp.custom_divisor = info->custom_divisor;
|
|
||||||
tmp.hub6 = 0;
|
|
||||||
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
|
if (copy_to_user(retinfo, &tmp, sizeof(*retinfo)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user