nvme: fix parameter check in nvme_fault_inject_init()
authorMinjie Du <duminjie@vivo.com>
Wed, 12 Jul 2023 11:18:37 +0000 (19:18 +0800)
committerKeith Busch <kbusch@kernel.org>
Wed, 12 Jul 2023 15:48:33 +0000 (08:48 -0700)
Make IS_ERR() judge the debugfs_create_dir() function return.

Signed-off-by: Minjie Du <duminjie@vivo.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/fault_inject.c

index 83d2e68..1ba10a5 100644 (file)
@@ -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;
        }