From: Jie Liu <[email protected]> It's better to return the actual error rather than NULL because kset_register() can failed due to other reasons.
Cc: Christoph Lameter <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Matt Mackall <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Martin Schwidefsky <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Herbert Xu <[email protected]> Cc: David S. Miller <[email protected]> Cc: Stefan Richter <[email protected]> Cc: Joerg Roedel <[email protected]> Cc: James E.J. Bottomley <[email protected]> Cc: Helge Deller <[email protected]> Cc: Bjorn Helgaas <[email protected]> Cc: Chris Mason <[email protected]> Cc: Josef Bacik <[email protected]> Cc: Steven Whitehouse <[email protected]> Cc: Boaz Harrosh <[email protected]> Cc: Benny Halevy <[email protected]> Cc: Christine Caulfield <[email protected]> Cc: David Teigland <[email protected]> Cc: Theodore Ts'o <[email protected]> Cc: Andreas Dilger <[email protected]> Cc: Jaegeuk Kim <[email protected]> Cc: Changman Lee <[email protected]> Cc: Mark Fasheh <[email protected]> Cc: Joel Becker <[email protected]> Cc: Casey Schaufler <[email protected]> Signed-off-by: Jie Liu <[email protected]> --- lib/kobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/kobject.c b/lib/kobject.c index 58751bb..538c617 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -919,11 +919,11 @@ struct kset *kset_create_and_add(const char *name, kset = kset_create(name, uevent_ops, parent_kobj); if (!kset) - return NULL; + return ERR_PTR(-ENOMEM); error = kset_register(kset); if (error) { kfree(kset); - return NULL; + return ERR_PTR(error); } return 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/

