linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yan Hong <clouds.yan@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org
Subject: [PATCH 1/2] tty: remove redundant initialization in initialize_tty_struct()
Date: Fri, 23 Nov 2012 22:41:47 +0800	[thread overview]
Message-ID: <1353681708-5413-1-git-send-email-clouds.yan@gmail.com> (raw)

tty_struct is already zeroed, no need to zero its field again.

Signed-off-by: Yan Hong <clouds.yan@gmail.com>
---
Actually alloc_tty_struct() already zerod tty_struct. Logically speaking
these two functions can be called independently, but they are always called
in pair in current code. Maybe someday we can arrange only one of them
zero the memory and let the other expect a zeroed tty_struct (and document
this assumption).

 drivers/tty/tty_io.c |    2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 2ea176b..e278edf 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2935,8 +2935,6 @@ void initialize_tty_struct(struct tty_struct *tty,
 	kref_init(&tty->kref);
 	tty->magic = TTY_MAGIC;
 	tty_ldisc_init(tty);
-	tty->session = NULL;
-	tty->pgrp = NULL;
 	tty->overrun_time = jiffies;
 	tty_buffer_init(tty);
 	mutex_init(&tty->legacy_mutex);
-- 
1.7.9.5


             reply	other threads:[~2012-11-23 14:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 14:41 Yan Hong [this message]
2012-11-23 14:41 ` [PATCH 2/2] tty: remove useless initialization in tty_open Yan Hong
2012-11-23 14:51 ` [PATCH 1/2] tty: remove redundant initialization in initialize_tty_struct() Alan Cox
2012-11-23 15:04   ` Yan Hong
2012-12-20 15:55     ` Alan Cox

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=1353681708-5413-1-git-send-email-clouds.yan@gmail.com \
    --to=clouds.yan@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-serial@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;
as well as URLs for NNTP newsgroup(s).