]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ntb: intel: Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
authorJinjie Ruan <ruanjinjie@huawei.com>
Thu, 31 Aug 2023 12:39:27 +0000 (20:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:07:55 +0000 (15:07 +0200)
[ Upstream commit e229897d373a87ee09ec5cc4ecd4bb2f895fc16b ]

The debugfs_create_dir() function returns error pointers.
It never returns NULL. So use IS_ERR() to check it.

Fixes: e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers")
Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ntb/hw/intel/ntb_hw_gen1.c

index 4f1add57d81dec87ae2b36154b535a54f48e975f..16e34bb8e69eabc154fb6cbadabc6e755cbb0580 100644 (file)
@@ -778,7 +778,7 @@ static void ndev_init_debugfs(struct intel_ntb_dev *ndev)
                ndev->debugfs_dir =
                        debugfs_create_dir(pci_name(ndev->ntb.pdev),
                                           debugfs_dir);
-               if (!ndev->debugfs_dir)
+               if (IS_ERR(ndev->debugfs_dir))
                        ndev->debugfs_info = NULL;
                else
                        ndev->debugfs_info =