[SCSI] st: Fixup -ENOMEDIUM
authorKai Makisara <Kai.Makisara@kolumbus.fi>
Thu, 5 Oct 2006 19:59:46 +0000 (22:59 +0300)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Wed, 25 Oct 2006 22:11:59 +0000 (15:11 -0700)
Based on the original patch from Hannes Reinecke <hare@suse.de>

Fix st_open() to return -ENOMEDIUM instead of -EIO if no medium is
found.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/st.c

index 3babdc76b3fb37f3e361243f8d5b7167a0d85f8b..e1a52c525ed492155a8243722e4387428198548b 100644 (file)
@@ -1177,7 +1177,10 @@ static int st_open(struct inode *inode, struct file *filp)
                goto err_out;
        if ((filp->f_flags & O_NONBLOCK) == 0 &&
            retval != CHKRES_READY) {
-               retval = (-EIO);
+               if (STp->ready == NO_TAPE)
+                       retval = (-ENOMEDIUM);
+               else
+                       retval = (-EIO);
                goto err_out;
        }
        return 0;