From: Bartlomiej Zolnierkiewicz <bzolnier@gmail•com>
To: Stephen Rothwell <sfr@canb•auug.org.au>,
Alan Cox <alan@lxorguk•ukuu.org.uk>
Cc: linux-next@vger•kernel.org, LKML <linux-kernel@vger•kernel.org>
Subject: Re: linux-next: Tree for March 12 (tty)
Date: Sat, 14 Mar 2009 14:11:49 +0100 [thread overview]
Message-ID: <200903141411.50185.bzolnier@gmail.com> (raw)
In-Reply-To: <20090312171154.11c6ec31.sfr@canb.auug.org.au>
Hi,
On Thursday 12 March 2009, Stephen Rothwell wrote:
> Hi all,
>
> Changes since 20090311:
It fails to boot here (both with QEMU and the real hardware):
...
Warning: unable to open an initial console.
Kernel panic - not syncing: Attempted to kill init!
...
I bisected the problem to:
>From 31f8326f981117fc548d292656fa8dbed28bc42b Mon Sep 17 00:00:00 2001
From: Alan Cox <alan@lxorguk•ukuu.org.uk>
Date: Thu, 12 Mar 2009 10:00:15 +1100
Subject: [PATCH] tty-fix-mismatch-in-lookup-han
The lookup methods return NULL or a pointer. The caller expects an ERR_PTR.
It seems to make sense to just use NULL and return -ENODEV here as it keeps
the code simple and clean and the way it always used to work (effectively)
before the restructure
Problem noticed by Jiri Slaby.
Signed-off-by: Alan Cox <alan@lxorguk•ukuu.org.uk>
---
drivers/char/tty_io.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index bc84e12..0cc0c60 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1817,9 +1817,9 @@ got_driver:
/* check whether we're reopening an existing tty */
tty = tty_driver_lookup_tty(driver, inode, index);
- if (IS_ERR(tty)) {
+ if (tty == NULL) {
mutex_unlock(&tty_mutex);
- return PTR_ERR(tty);
+ return -ENODEV;
}
}
--
It seems that fixing IS_ERR() check uncovered some underlying problem
since we are later checking for tty == NULL in __tty_open().
The following patch fixes the issue for me (Alan, feel free to merge
it back into your tty-fix-mismatch-in-lookup-han patch or replace by
a more complete __tty_open() reorganization):
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail•com>
Subject: [PATCH] tty: fix __tty_open()
On tty_driver_lookup_tty() failure __tty_open() should continue
instead of returning an error, fix it.
Also update tty_driver_lookup_tty() documentation while at it.
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail•com>
---
drivers/char/tty_io.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
Index: b/drivers/char/tty_io.c
===================================================================
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1205,7 +1205,7 @@ static void tty_line_name(struct tty_dri
* @driver: the driver for the tty
* @idx: the minor number
*
- * Return the tty, if found or ERR_PTR() otherwise.
+ * Return the tty, if found or NULL otherwise.
*
* Locking: tty_mutex must be held. If tty is found, the mutex must
* be held until the 'fast-open' is also done. Will change once we
@@ -1813,16 +1813,10 @@ retry_open:
return -ENODEV;
}
got_driver:
- if (!tty) {
+ if (!tty)
/* check whether we're reopening an existing tty */
tty = tty_driver_lookup_tty(driver, inode, index);
- if (tty == NULL) {
- mutex_unlock(&tty_mutex);
- return -ENODEV;
- }
- }
-
if (tty) {
retval = tty_reopen(tty);
if (retval)
next prev parent reply other threads:[~2009-03-14 13:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-12 6:11 linux-next: Tree for March 12 Stephen Rothwell
2009-03-12 8:29 ` Next 12 : arch/powerpc/sysdev/axonram build failure Sachin Sant
2009-03-12 12:16 ` Michael Ellerman
2009-03-12 13:01 ` Sachin Sant
2009-03-13 10:35 ` Kernel panic on linux-nextMarch 12 Nico -telmich- Schottelius
2009-03-14 13:11 ` Bartlomiej Zolnierkiewicz [this message]
2009-03-14 14:19 ` linux-next: Tree for March 12 (tty) Alan Cox
2009-03-14 16:54 ` Alan Cox
2009-03-15 13:42 ` Stephen Rothwell
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=200903141411.50185.bzolnier@gmail.com \
--to=bzolnier@gmail$(echo .)com \
--cc=alan@lxorguk$(echo .)ukuu.org.uk \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=sfr@canb$(echo .)auug.org.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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