[PATCH 02/24] sample/kobject: update kset-example code

From: Jeff Liu
Date: Tue Jun 17 2014 - 10:26:59 EST


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

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

Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/