]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/block_dev.c
drivers: fix up various ->llseek() implementations
[mirror_ubuntu-zesty-kernel.git] / fs / block_dev.c
index 610e8e0b04b88946721eb58b78791bab0e72440b..966617a422d98bd905699c0d34d44c6e4f29bddb 100644 (file)
@@ -355,20 +355,25 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin)
        mutex_lock(&bd_inode->i_mutex);
        size = i_size_read(bd_inode);
 
+       retval = -EINVAL;
        switch (origin) {
-               case 2:
+               case SEEK_END:
                        offset += size;
                        break;
-               case 1:
+               case SEEK_CUR:
                        offset += file->f_pos;
+               case SEEK_SET:
+                       break;
+               default:
+                       goto out;
        }
-       retval = -EINVAL;
        if (offset >= 0 && offset <= size) {
                if (offset != file->f_pos) {
                        file->f_pos = offset;
                }
                retval = offset;
        }
+out:
        mutex_unlock(&bd_inode->i_mutex);
        return retval;
 }