Skip to content

Commit 33799a6

Browse files
musicakcralfbaechle
authored andcommitted
MIPS: Modify error handling
debugfs_create_file returns NULL on error so an IS_ERR test is incorrect here and a NULL check is required. The Coccinelle semantic patch used to make this change is as follows: @@ expression e; @@ e = debugfs_create_file(...); if( - IS_ERR(e) + !e ) { <+... return - PTR_ERR(e) + -ENOMEM ; ...+> } Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Cc: julia.lawall@lip6.fr Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/13834/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 11f7690 commit 33799a6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/mips/mm/sc-debugfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ static int __init sc_debugfs_init(void)
7373

7474
file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir,
7575
NULL, &sc_prefetch_fops);
76-
if (IS_ERR(file))
77-
return PTR_ERR(file);
76+
if (!file)
77+
return -ENOMEM;
7878

7979
return 0;
8080
}

0 commit comments

Comments
 (0)