linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Julian Anastasov <ja@ssi.bg>
To: Jiri Slaby <jslaby@suse.cz>
Cc: gregkh@suse.de, jirislaby@gmail.com,
	linux-kernel@vger.kernel.org, Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH 1/6] TTY: unify tty_init_dev fail path handling
Date: Wed, 23 Mar 2011 22:53:00 +0200 (EET)	[thread overview]
Message-ID: <alpine.LFD.2.00.1103232250160.1634@ja.ssi.bg> (raw)
In-Reply-To: <1300873717-27941-1-git-send-email-jslaby@suse.cz>


 	Hello,

On Wed, 23 Mar 2011, Jiri Slaby wrote:

> Change it so that we call the deinit functions at one place at the end
> of the function (by gotos). And while at it use some sane label names.
>
> This is a preparation for the deinitialization of tty in the next
> patch.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Cc: Julian Anastasov <ja@ssi.bg>
> ---
>
> This is not tested yet, I'm building a kernel to test it a bit, but it
> will take some time. If you could too to check if your problem
> dissapears, it would be great.

 	Thanks! Patches 1-5 work for me, I backported them
to 2.6.33.8 for the test.

>
> P.S. the drivers/char/tty_<TAB><TAB> habit sucks :).
>                 ^^^^
>
> drivers/tty/tty_io.c |   23 ++++++++++++-----------
> 1 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index 936a4ea..6312cc3 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -1391,16 +1391,15 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
> 		return ERR_PTR(-ENODEV);
>
> 	tty = alloc_tty_struct();
> -	if (!tty)
> -		goto fail_no_mem;
> +	if (!tty) {
> +		retval = -ENOMEM;
> +		goto err_module_put;
> +	}
> 	initialize_tty_struct(tty, driver, idx);
>
> 	retval = tty_driver_install_tty(driver, tty);
> -	if (retval < 0) {
> -		free_tty_struct(tty);
> -		module_put(driver->owner);
> -		return ERR_PTR(retval);
> -	}
> +	if (retval < 0)
> +		goto err_free_tty;
>
> 	/*
> 	 * Structures all installed ... call the ldisc open routines.
> @@ -1409,15 +1408,17 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
> 	 */
> 	retval = tty_ldisc_setup(tty, tty->link);
> 	if (retval)
> -		goto release_mem_out;
> +		goto err_release_tty;
> 	return tty;
>
> -fail_no_mem:
> +err_free_tty:
> +	free_tty_struct(tty);
> +err_module_put:
> 	module_put(driver->owner);
> -	return ERR_PTR(-ENOMEM);
> +	return ERR_PTR(retval);
>
> 	/* call the tty release_tty routine to clean out this slot */
> -release_mem_out:
> +err_release_tty:
> 	if (printk_ratelimit())
> 		printk(KERN_INFO "tty_init_dev: ldisc open failed, "
> 				 "clearing slot %d\n", idx);
> -- 
> 1.7.4.1

Regards

--
Julian Anastasov <ja@ssi.bg>

  parent reply	other threads:[~2011-03-23 20:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23  9:48 [PATCH 1/6] TTY: unify tty_init_dev fail path handling Jiri Slaby
2011-03-23  9:48 ` [PATCH 2/6] TTY: unify pty_install " Jiri Slaby
2011-03-23  9:48 ` [PATCH 3/6] TTY: unify pty_unix98_install " Jiri Slaby
2011-03-23  9:48 ` [PATCH 4/6] TTY: introduce deinit helpers for proper ldisc shutdown Jiri Slaby
2011-03-23  9:48 ` [PATCH 5/6] TTY: plug in deinitialize_tty_struct Jiri Slaby
2011-03-23  9:48 ` [PATCH 6/6] TTY: fix fail path in tty_open Jiri Slaby
2011-03-23 20:53 ` Julian Anastasov [this message]
2011-03-29 12:17   ` [PATCH 1/6] TTY: unify tty_init_dev fail path handling Jiri Slaby
2011-03-29 13:12     ` Greg KH

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=alpine.LFD.2.00.1103232250160.1634@ja.ssi.bg \
    --to=ja@ssi.bg \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@suse.de \
    --cc=jirislaby@gmail.com \
    --cc=jslaby@suse.cz \
    --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;
as well as URLs for NNTP newsgroup(s).