ntb.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] ntb: intel: Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
@ 2023-08-31 12:39 Jinjie Ruan
  2023-08-31 15:00 ` Dave Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: Jinjie Ruan @ 2023-08-31 12:39 UTC (permalink / raw)
  To: ntb, Dave Jiang, Jon Mason, Allen Hubbe; +Cc: ruanjinjie

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>
---
 drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c
index 9ab836d0d4f1..079b8cd79785 100644
--- a/drivers/ntb/hw/intel/ntb_hw_gen1.c
+++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c
@@ -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 =
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ntb: intel: Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
  2023-08-31 12:39 [PATCH] ntb: intel: Fix the NULL vs IS_ERR() bug for debugfs_create_dir() Jinjie Ruan
@ 2023-08-31 15:00 ` Dave Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2023-08-31 15:00 UTC (permalink / raw)
  To: Jinjie Ruan, ntb, Jon Mason, Allen Hubbe



On 8/31/23 05:39, Jinjie Ruan wrote:
> 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>

Thank you!

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>   drivers/ntb/hw/intel/ntb_hw_gen1.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ntb/hw/intel/ntb_hw_gen1.c b/drivers/ntb/hw/intel/ntb_hw_gen1.c
> index 9ab836d0d4f1..079b8cd79785 100644
> --- a/drivers/ntb/hw/intel/ntb_hw_gen1.c
> +++ b/drivers/ntb/hw/intel/ntb_hw_gen1.c
> @@ -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 =

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-31 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-31 12:39 [PATCH] ntb: intel: Fix the NULL vs IS_ERR() bug for debugfs_create_dir() Jinjie Ruan
2023-08-31 15:00 ` Dave Jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).