[PATCH v1] drivers: host: fix parameter check in nvme_fault_inject_init()

Minjie Du posted 1 patch 2 years, 6 months ago
drivers/nvme/host/fault_inject.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v1] drivers: host: fix parameter check in nvme_fault_inject_init()
Posted by Minjie Du 2 years, 6 months ago
Make IS_ERR() judge the debugfs_create_dir() function return.

Signed-off-by: Minjie Du <duminjie@vivo.com>
---
 drivers/nvme/host/fault_inject.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/fault_inject.c b/drivers/nvme/host/fault_inject.c
index 83d2e6860..1ba10a5c6 100644
--- a/drivers/nvme/host/fault_inject.c
+++ b/drivers/nvme/host/fault_inject.c
@@ -27,7 +27,7 @@ void nvme_fault_inject_init(struct nvme_fault_inject *fault_inj,
 
 	/* create debugfs directory and attribute */
 	parent = debugfs_create_dir(dev_name, NULL);
-	if (!parent) {
+	if (IS_ERR(parent)) {
 		pr_warn("%s: failed to create debugfs directory\n", dev_name);
 		return;
 	}
-- 
2.39.0
Re: [PATCH v1] drivers: host: fix parameter check in nvme_fault_inject_init()
Posted by Christoph Hellwig 2 years, 6 months ago
Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Re: [PATCH v1] drivers: host: fix parameter check in nvme_fault_inject_init()
Posted by Keith Busch 2 years, 6 months ago
Applied, thanks!