mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 04:37:32 -04:00
error-inject: use IS_ERR() check for debugfs_create_file()
debugfs_create_file() returns an error pointer on failure, never NULL, so the !file check in ei_debugfs_init() never triggers and the debugfs_remove() cleanup cannot run. Use IS_ERR() and propagate the actual error via PTR_ERR(). Link: https://lore.kernel.org/20260514193214.2432769-1-ingyujang25@korea.ac.kr Signed-off-by: Ingyu Jang <ingyujang25@korea.ac.kr> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
committed by
Andrew Morton
parent
f5b1910e23
commit
4d80db59de
@@ -219,9 +219,9 @@ static int __init ei_debugfs_init(void)
|
||||
dir = debugfs_create_dir("error_injection", NULL);
|
||||
|
||||
file = debugfs_create_file("list", 0444, dir, NULL, &ei_fops);
|
||||
if (!file) {
|
||||
if (IS_ERR(file)) {
|
||||
debugfs_remove(dir);
|
||||
return -ENOMEM;
|
||||
return PTR_ERR(file);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user