public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 02/24] sample/kobject: update kset-example code
@ 2014-06-17 14:26 Jeff Liu
  2014-06-17 19:22 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Liu @ 2014-06-17 14:26 UTC (permalink / raw)
  To: gregkh; +Cc: Christoph Lameter, LKML, Andrew Morton

From: Jie Liu <jeff.liu@oracle.com>
Subject: sample/kobject: update kset-example code

Check and return the error ptr if call kset_create_and_add() failed

Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 samples/kobject/kset-example.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index ab5e447..c2911d9 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -238,8 +238,8 @@ static int __init example_init(void)
 	 * located under /sys/kernel/
 	 */
 	example_kset = kset_create_and_add("kset_example", NULL, kernel_kobj);
-	if (!example_kset)
-		return -ENOMEM;
+	if (IS_ERR(example_kset))
+		return PTR_ERR(example_kset);
 
 	/*
 	 * Create three objects and register them with our kset
-- 
1.8.3.2

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

end of thread, other threads:[~2014-06-17 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-17 14:26 [PATCH 02/24] sample/kobject: update kset-example code Jeff Liu
2014-06-17 19:22 ` Greg KH
2014-06-17 19:30   ` Christoph Lameter

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