Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

char: misc: Use IS_ERR() for filp_open() return value

filp_open() never returns NULL, it returns either a valid pointer or an
error pointer. Using IS_ERR_OR_NULL() is unnecessary. Additionally, if
filp were NULL, PTR_ERR(NULL) would return 0, leading to a misleading
error message.

Fixes: 74d8361be344 ("char: misc: add test cases")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202506132058.thWZHlrb-lkp@intel.com/
Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@igalia.com>
Link: https://patch.msgid.link/20251226230248.113073-1-alperyasinak1@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alper Ak and committed by
Greg Kroah-Hartman
e849ada7 dad9f13d

+1 -1
+1 -1
drivers/char/misc_minor_kunit.c
··· 166 166 KUNIT_FAIL(test, "failed to create node\n"); 167 167 168 168 filp = filp_open(devname, O_RDONLY, 0); 169 - if (IS_ERR_OR_NULL(filp)) 169 + if (IS_ERR(filp)) 170 170 KUNIT_FAIL(test, "failed to open misc device: %ld\n", PTR_ERR(filp)); 171 171 else 172 172 fput(filp);