Skip to contentSkip to conversation

block-dev: checking for NULL instead of IS_ERR()

PATCH In review Dan Carpenter 2 participants 2 messages Mar 8, 2016 – Mar 15, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 block-dev: checking for NULL instead of IS_ERR()

This should be an IS_ERR() check. mount_pseudo() returns error pointers and this function should return the error pointer to its caller as well.

Fixes 3684aa7099e0 ('block-dev: enable writeback cgroup support')
fs/block_dev.c +1 -1
index 3172c4e..2de969e 100644
@@ -577,7 +577,7 @@ static struct dentry *bd_mount(struct file_system_type *fs_type,
 {
 	struct dentry *dent;
 	dent = mount_pseudo(fs_type, "bdev:", &bdev_sops, NULL, BDEVFS_MAGIC);
-	if (dent)
+	if (!IS_ERR(dent))
 		dent->d_sb->s_iflags |= SB_I_CGROUPWB;
 	return dent;
 }
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

This should be an IS_ERR() check. mount_pseudo() returns error pointers and this function should return the error pointer to its caller as well.

Fixes 3684aa7099e0 ('block-dev: enable writeback cgroup support')

Looks fine. Would be much nicer to simply pass possible flags as an argument to mount_pseudo to avoid this whole dance..