public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kernel: locking: Updates return value check
@ 2023-08-07 12:18 Atul Kumar Pant
  2023-10-03  8:31 ` [tip: locking/core] locking/debug: Fix debugfs API return value checks to use IS_ERR() tip-bot2 for Atul Kumar Pant
  0 siblings, 1 reply; 2+ messages in thread
From: Atul Kumar Pant @ 2023-08-07 12:18 UTC (permalink / raw)
  To: peterz, mingo, will, longman, boqun.feng
  Cc: Atul Kumar Pant, shuah, linux-kernel-mentees, linux-kernel

Updating the check of return value from debugfs_create_file
and debugfs_create_dir to use IS_ERR.

Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
Acked-by: Waiman Long <longman@redhat.com>
---

changes since v1:
    Adding linux-kernel@vger.kernel.org mailing list and retaining
    Acked-by tag from Waiman Long

 kernel/locking/lock_events.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/locking/lock_events.c b/kernel/locking/lock_events.c
index fa2c2f951c6b..e68d82099558 100644
--- a/kernel/locking/lock_events.c
+++ b/kernel/locking/lock_events.c
@@ -146,7 +146,7 @@ static int __init init_lockevent_counts(void)
 	struct dentry *d_counts = debugfs_create_dir(LOCK_EVENTS_DIR, NULL);
 	int i;
 
-	if (!d_counts)
+	if (IS_ERR(d_counts))
 		goto out;
 
 	/*
@@ -159,14 +159,14 @@ static int __init init_lockevent_counts(void)
 	for (i = 0; i < lockevent_num; i++) {
 		if (skip_lockevent(lockevent_names[i]))
 			continue;
-		if (!debugfs_create_file(lockevent_names[i], 0400, d_counts,
-					 (void *)(long)i, &fops_lockevent))
+		if (IS_ERR(debugfs_create_file(lockevent_names[i], 0400, d_counts,
+					 (void *)(long)i, &fops_lockevent)))
 			goto fail_undo;
 	}
 
-	if (!debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
+	if (IS_ERR(debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
 				 d_counts, (void *)(long)LOCKEVENT_reset_cnts,
-				 &fops_lockevent))
+				 &fops_lockevent)))
 		goto fail_undo;
 
 	return 0;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip: locking/core] locking/debug: Fix debugfs API return value checks to use IS_ERR()
  2023-08-07 12:18 [PATCH v2] kernel: locking: Updates return value check Atul Kumar Pant
@ 2023-10-03  8:31 ` tip-bot2 for Atul Kumar Pant
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Atul Kumar Pant @ 2023-10-03  8:31 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Atul Kumar Pant, Ingo Molnar, Waiman Long, x86, linux-kernel

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     8788c6c2feb3600ba1a2f84ac5d258af4a284cea
Gitweb:        https://git.kernel.org/tip/8788c6c2feb3600ba1a2f84ac5d258af4a284cea
Author:        Atul Kumar Pant <atulpant.linux@gmail.com>
AuthorDate:    Mon, 07 Aug 2023 17:48:34 +05:30
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Tue, 03 Oct 2023 10:11:25 +02:00

locking/debug: Fix debugfs API return value checks to use IS_ERR()

Update the checking of return values from debugfs_create_file()
and debugfs_create_dir() to use IS_ERR().

Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Waiman Long <longman@redhat.com>
Link: https://lore.kernel.org/r/20230807121834.7438-1-atulpant.linux@gmail.com
---
 kernel/locking/lock_events.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/locking/lock_events.c b/kernel/locking/lock_events.c
index fa2c2f9..e68d820 100644
--- a/kernel/locking/lock_events.c
+++ b/kernel/locking/lock_events.c
@@ -146,7 +146,7 @@ static int __init init_lockevent_counts(void)
 	struct dentry *d_counts = debugfs_create_dir(LOCK_EVENTS_DIR, NULL);
 	int i;
 
-	if (!d_counts)
+	if (IS_ERR(d_counts))
 		goto out;
 
 	/*
@@ -159,14 +159,14 @@ static int __init init_lockevent_counts(void)
 	for (i = 0; i < lockevent_num; i++) {
 		if (skip_lockevent(lockevent_names[i]))
 			continue;
-		if (!debugfs_create_file(lockevent_names[i], 0400, d_counts,
-					 (void *)(long)i, &fops_lockevent))
+		if (IS_ERR(debugfs_create_file(lockevent_names[i], 0400, d_counts,
+					 (void *)(long)i, &fops_lockevent)))
 			goto fail_undo;
 	}
 
-	if (!debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
+	if (IS_ERR(debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
 				 d_counts, (void *)(long)LOCKEVENT_reset_cnts,
-				 &fops_lockevent))
+				 &fops_lockevent)))
 		goto fail_undo;
 
 	return 0;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-03  8:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-07 12:18 [PATCH v2] kernel: locking: Updates return value check Atul Kumar Pant
2023-10-03  8:31 ` [tip: locking/core] locking/debug: Fix debugfs API return value checks to use IS_ERR() tip-bot2 for Atul Kumar Pant

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox