Make IS_ERR() judge the debugfs_create_dir() function return in ei_debugfs_init(). Signed-off-by: Minjie Du <duminjie@xxxxxxxx> --- lib/error-inject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/error-inject.c b/lib/error-inject.c index 32c147705..9dd2c5ca3 100644 --- a/lib/error-inject.c +++ b/lib/error-inject.c @@ -217,11 +217,11 @@ static int __init ei_debugfs_init(void) struct dentry *dir, *file; dir = debugfs_create_dir("error_injection", NULL); - if (!dir) + if (IS_ERR(dir)) return -ENOMEM; file = debugfs_create_file("list", 0444, dir, NULL, &ei_fops); - if (!file) { + if (IS_ERR(file)) { debugfs_remove(dir); return -ENOMEM; } -- 2.39.0