Merge remote-tracking branch 'asoc/fix/cirrus' into asoc-linus
[firefly-linux-kernel-4.4.55.git] / mm / shmem.c
index a63031fa3e0c1e4380e6937aa711df912c9a687f..cf2d0ca010bc52efd5ea86c7f6ba760a5c3ef286 100644 (file)
@@ -1455,6 +1455,9 @@ static struct inode *shmem_get_inode(struct super_block *sb, const struct inode
 
 bool shmem_mapping(struct address_space *mapping)
 {
+       if (!mapping->host)
+               return false;
+
        return mapping->host->i_sb->s_op == &shmem_ops;
 }
 
@@ -2319,8 +2322,8 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry)
 
 static int shmem_exchange(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry)
 {
-       bool old_is_dir = S_ISDIR(old_dentry->d_inode->i_mode);
-       bool new_is_dir = S_ISDIR(new_dentry->d_inode->i_mode);
+       bool old_is_dir = d_is_dir(old_dentry);
+       bool new_is_dir = d_is_dir(new_dentry);
 
        if (old_dir != new_dir && old_is_dir != new_is_dir) {
                if (old_is_dir) {