From: Yeqi Fu Date: Wed, 17 May 2023 17:31:11 +0000 (+0800) Subject: EDAC/thunderx: Check debugfs file creation retval properly X-Git-Tag: v6.5-rc1~227^2~1^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf5c04ddd378dbd62d41d9c5bd18cca03bee2946;p=thirdparty%2Fkernel%2Flinux.git EDAC/thunderx: Check debugfs file creation retval properly 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 Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20230517173111.365787-1-asuk4.q@gmail.com --- diff --git a/drivers/edac/thunderx_edac.c b/drivers/edac/thunderx_edac.c index 0bcd9f02c84a4..b9c5772da959c 100644 --- a/drivers/edac/thunderx_edac.c +++ b/drivers/edac/thunderx_edac.c @@ -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; }