From: Jie Liu <[email protected]>
Subject: sample/kobject: update kset-example code

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

Cc: Christoph Lameter <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Jie Liu <[email protected]>
---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to