Skip to content

Commit 4913cfc

Browse files
ivanorlov2206axboe
authored andcommitted
nbd: Fix debugfs_create_dir error checking
The debugfs_create_dir function returns ERR_PTR in case of error, and the only correct way to check if an error occurred is 'IS_ERR' inline function. This patch will replace the null-comparison with IS_ERR. Signed-off-by: Ivan Orlov <ivan.orlov0322@gmail.com> Link: https://lore.kernel.org/r/20230512130533.98709-1-ivan.orlov0322@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent ac9a786 commit 4913cfc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/block/nbd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)
16661666
return -EIO;
16671667

16681668
dir = debugfs_create_dir(nbd_name(nbd), nbd_dbg_dir);
1669-
if (!dir) {
1669+
if (IS_ERR(dir)) {
16701670
dev_err(nbd_to_dev(nbd), "Failed to create debugfs dir for '%s'\n",
16711671
nbd_name(nbd));
16721672
return -EIO;
@@ -1692,7 +1692,7 @@ static int nbd_dbg_init(void)
16921692
struct dentry *dbg_dir;
16931693

16941694
dbg_dir = debugfs_create_dir("nbd", NULL);
1695-
if (!dbg_dir)
1695+
if (IS_ERR(dbg_dir))
16961696
return -EIO;
16971697

16981698
nbd_dbg_dir = dbg_dir;

0 commit comments

Comments
 (0)