aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-10-13 05:46:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 12:51:44 -0400
commita18992d4652553f65469ac72b54b7fdd4f058277 (patch)
tree76b9347d3e11f0ef125f3466560f565e88a52d38 /drivers/s390/char
parenta90610e50b98e18385d4fbea2c9eaefb12c5a75c (diff)
fs3270: Correct error returns
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>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/fs3270.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
index 1227f4591f8d..40759c33477d 100644
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -418,23 +418,22 @@ fs3270_open(struct inode *inode, struct file *filp)
418{ 418{
419 struct fs3270 *fp; 419 struct fs3270 *fp;
420 struct idal_buffer *ib; 420 struct idal_buffer *ib;
421 int minor, rc; 421 int minor, rc = 0;
422 422
423 if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR) 423 if (imajor(filp->f_path.dentry->d_inode) != IBM_FS3270_MAJOR)
424 return -ENODEV; 424 return -ENODEV;
425 lock_kernel();
426 minor = iminor(filp->f_path.dentry->d_inode); 425 minor = iminor(filp->f_path.dentry->d_inode);
427 /* Check for minor 0 multiplexer. */ 426 /* Check for minor 0 multiplexer. */
428 if (minor == 0) { 427 if (minor == 0) {
429 struct tty_struct *tty = get_current_tty(); 428 struct tty_struct *tty = get_current_tty();
430 if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) { 429 if (!tty || tty->driver->major != IBM_TTY3270_MAJOR) {
431 tty_kref_put(tty); 430 tty_kref_put(tty);
432 rc = -ENODEV; 431 return -ENODEV;
433 goto out;
434 } 432 }
435 minor = tty->index + RAW3270_FIRSTMINOR; 433 minor = tty->index + RAW3270_FIRSTMINOR;
436 tty_kref_put(tty); 434 tty_kref_put(tty);
437 } 435 }
436 lock_kernel();
438 /* Check if some other program is already using fullscreen mode. */ 437 /* Check if some other program is already using fullscreen mode. */
439 fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor); 438 fp = (struct fs3270 *) raw3270_find_view(&fs3270_fn, minor);
440 if (!IS_ERR(fp)) { 439 if (!IS_ERR(fp)) {
@@ -476,7 +475,7 @@ fs3270_open(struct inode *inode, struct file *filp)
476 filp->private_data = fp; 475 filp->private_data = fp;
477out: 476out:
478 unlock_kernel(); 477 unlock_kernel();
479 return 0; 478 return rc;
480} 479}
481 480
482/* 481/*