From: Jiri Slaby <jirislaby@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-kernel@vger.kernel.org>, Jiri Slaby <jirislaby@gmail.com>,
Jan Engelhardt <jengelh@computergmbh.de>
Subject: [PATCH 4/7] Char: mxser, simplify mxser_get_serial_info
Date: Fri, 18 Jan 2008 15:31:13 +0100 [thread overview]
Message-ID: <1200666676-1234-4-git-send-email-jirislaby@gmail.com> (raw)
In-Reply-To: <1200666676-1234-1-git-send-email-jirislaby@gmail.com>
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>
---
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 9449fba..937c101 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)
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;
--
1.5.3.7
next prev parent reply other threads:[~2008-01-18 14:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-18 14:31 [PATCH 1/7] Char: mxser, remove special baudrate processing Jiri Slaby
2008-01-18 14:31 ` [PATCH 2/7] Char: mxser, 0 to NULL in pointer Jiri Slaby
2008-01-18 14:31 ` [PATCH 3/7] Char: mxser, reorder mxser_cardinfo fields Jiri Slaby
2008-01-18 14:31 ` Jiri Slaby [this message]
2008-01-18 14:31 ` [PATCH 5/7] Char: mxser, ioctl cleanup Jiri Slaby
2008-01-18 14:31 ` [PATCH 6/7] Char: mxser, remove it Jiri Slaby
2008-01-18 15:52 ` Alan Cox
2008-01-18 14:31 ` [PATCH 7/7] Char: mxser, add support for CP-114UL Jiri Slaby
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1200666676-1234-4-git-send-email-jirislaby@gmail.com \
--to=jirislaby@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=jengelh@computergmbh.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®