Skip to content

Commit

Permalink
fs3270: Correct error returns
Browse files Browse the repository at this point in the history
Drop the kernel lock further and also correct cases where we set rc to an
error code, and then return 0

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alan Cox authored and Linus Torvalds committed Oct 13, 2008
1 parent a90610e commit a18992d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions drivers/s390/char/fs3270.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,23 +418,22 @@ fs3270_open(struct inode *inode, struct file *filp)
{
struct fs3270 *fp;
struct idal_buffer *ib;
int minor, rc;
int minor, rc = 0;

if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR)
return -ENODEV;
lock_kernel();
minor = iminor(filp->f_path.dentry->d_inode);
/* Check for minor 0 multiplexer. */
if (minor == 0) {
struct tty_struct *tty = get_current_tty();
if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) {
tty_kref_put(tty);
rc = -ENODEV;
goto out;
return -ENODEV;
}
minor = tty->index + RAW3270_FIRSTMINOR;
tty_kref_put(tty);
}
lock_kernel();
/* Check if some other program is already using fullscreen mode. */
fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor);
if (!IS_ERR(fp)) {
Expand Down Expand Up @@ -476,7 +475,7 @@ fs3270_open(struct inode *inode, struct file *filp)
filp->private_data = fp;
out:
unlock_kernel();
return 0;
return rc;
}

/*
Expand Down

0 comments on commit a18992d

Please sign in to comment.