diff mbox

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

Message ID 20160308120546.GB28684@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter March 8, 2016, 12:05 p.m. UTC
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')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Christoph Hellwig March 15, 2016, 7:26 a.m. UTC | #1
On Tue, Mar 08, 2016 at 03:05:46PM +0300, Dan Carpenter wrote:
> 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')
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

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

Reviewed-by: Christoph Hellwig <hch@lst.de>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/block_dev.c b/fs/block_dev.c
index 3172c4e..2de969e 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -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;
 }