EDAC/thunderx: Check debugfs file creation retval properly
authorYeqi Fu <asuk4.q@gmail.com>
Wed, 17 May 2023 17:31:11 +0000 (01:31 +0800)
committerBorislav Petkov (AMD) <bp@alien8.de>
Tue, 6 Jun 2023 21:04:56 +0000 (23:04 +0200)
edac_debugfs_create_file() returns ERR_PTR by way of the respective
debugfs function it calls, if an error occurs.

The appropriate way to verify for errors is to use IS_ERR(). Do so.

  [ bp: Rewrite all text. ]

Signed-off-by: Yeqi Fu <asuk4.q@gmail.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20230517173111.365787-1-asuk4.q@gmail.com
drivers/edac/thunderx_edac.c

index 0bcd9f0..b9c5772 100644 (file)
@@ -481,7 +481,7 @@ static int thunderx_create_debugfs_nodes(struct dentry *parent,
                ent = edac_debugfs_create_file(attrs[i]->name, attrs[i]->mode,
                                               parent, data, &attrs[i]->fops);
 
-               if (!ent)
+               if (IS_ERR(ent))
                        break;
        }