mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
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: 74d8361be3 ("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>
This commit is contained in:
parent
dad9f13d96
commit
e849ada70c
1 changed files with 1 additions and 1 deletions
|
|
@ -166,7 +166,7 @@ static void __init miscdev_test_can_open(struct kunit *test, struct miscdevice *
|
|||
KUNIT_FAIL(test, "failed to create node\n");
|
||||
|
||||
filp = filp_open(devname, O_RDONLY, 0);
|
||||
if (IS_ERR_OR_NULL(filp))
|
||||
if (IS_ERR(filp))
|
||||
KUNIT_FAIL(test, "failed to open misc device: %ld\n", PTR_ERR(filp));
|
||||
else
|
||||
fput(filp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue