[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251226091451.33900-1-alperyasinak1@gmail.com>
Date: Fri, 26 Dec 2025 12:14:51 +0300
From: Alper Ak <alperyasinak1@...il.com>
To: arnd@...db.de,
gregkh@...uxfoundation.org
Cc: cascardo@...lia.com,
linux-kernel@...r.kernel.org,
Alper Ak <alperyasinak1@...il.com>
Subject: [PATCH] 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")
Signed-off-by: Alper Ak <alperyasinak1@...il.com>
---
drivers/char/misc_minor_kunit.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/char/misc_minor_kunit.c b/drivers/char/misc_minor_kunit.c
index 6fc8b05169c5..e930c78e1ef9 100644
--- a/drivers/char/misc_minor_kunit.c
+++ b/drivers/char/misc_minor_kunit.c
@@ -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);
--
2.43.0
Powered by blists - more mailing lists