Skip to content

Commit 11b72d4

Browse files
ivanorlov2206smb49
authored andcommitted
nbd: Fix debugfs_create_dir error checking
BugLink: https://bugs.launchpad.net/bugs/2029401 [ Upstream commit 4913cfc ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 320c1f9 commit 11b72d4

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
@@ -1642,7 +1642,7 @@ static int nbd_dev_dbg_init(struct nbd_device *nbd)
16421642
return -EIO;
16431643

16441644
dir = debugfs_create_dir(nbd_name(nbd), nbd_dbg_dir);
1645-
if (!dir) {
1645+
if (IS_ERR(dir)) {
16461646
dev_err(nbd_to_dev(nbd), "Failed to create debugfs dir for '%s'\n",
16471647
nbd_name(nbd));
16481648
return -EIO;
@@ -1668,7 +1668,7 @@ static int nbd_dbg_init(void)
16681668
struct dentry *dbg_dir;
16691669

16701670
dbg_dir = debugfs_create_dir("nbd", NULL);
1671-
if (!dbg_dir)
1671+
if (IS_ERR(dbg_dir))
16721672
return -EIO;
16731673

16741674
nbd_dbg_dir = dbg_dir;

0 commit comments

Comments
 (0)