public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: gregkh@linuxfoundation.org
Cc: Christoph Lameter <cl@gentwo.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>, Matt Mackall <mpm@selenic.com>,
	benh@kernel.crashing.org, paulus@samba.org,
	schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com,
	herbert@gondor.apana.org.au, davem@davemloft.net,
	stefanr@s5r6.in-berlin.de, joro@8bytes.org,
	jejb@parisc-linux.org, deller@gmx.de, bhelgaas@google.com,
	clm@fb.com, Josef Bacik <jbacik@fb.com>,
	swhiteho@redhat.com, bharrosh@panasas.com,
	bhalevy@primarydata.com, ccaulfie@redhat.com,
	teigland@redhat.com, "Theodore Ts'o" <tytso@mit.edu>,
	adilger.kernel@dilger.ca, jaegeuk@kernel.org,
	cm224.lee@samsung.com, Mark Fasheh <mfasheh@suse.com>,
	Joel Becker <jlbec@evilplan.org>,
	casey@schaufler-ca.com, LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 01/24] kobject: return actual error on kset_create_and_add
Date: Tue, 17 Jun 2014 22:25:59 +0800	[thread overview]
Message-ID: <53A04FF7.5050900@oracle.com> (raw)

From: Jie Liu <jeff.liu@oracle.com>

It's better to return the actual error rather than NULL because
kset_register() can failed due to other reasons.

Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Matt Mackall <mpm@selenic.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: David S. Miller <davem@davemloft.net>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: James E.J. Bottomley <JBottomley@parallels.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Chris Mason <clm@fb.com>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Steven Whitehouse <swhiteho@redhat.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Cc: Benny Halevy <bhalevy@primarydata.com>
Cc: Christine Caulfield <ccaulfie@redhat.com>
Cc: David Teigland <teigland@redhat.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Changman Lee <cm224.lee@samsung.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
---
 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

             reply	other threads:[~2014-06-17 14:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17 14:25 Jeff Liu [this message]
2014-06-17 14:42 ` [PATCH 01/24] kobject: return actual error on kset_create_and_add James Bottomley
2014-06-17 14:56   ` Jeff Liu
2014-06-17 15:50     ` Greg KH
2014-06-17 19:26       ` Greg KH
2014-06-18  1:40       ` Jeff Liu
2014-06-17 15:47 ` Greg KH
2014-06-17 16:00   ` Christoph Lameter
2014-06-17 16:09     ` James Bottomley
2014-06-17 16:29       ` Christoph Lameter
2014-06-17 16:54         ` James Bottomley
2014-06-17 19:21           ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53A04FF7.5050900@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=benh@kernel.crashing.org \
    --cc=bhalevy@primarydata.com \
    --cc=bharrosh@panasas.com \
    --cc=bhelgaas@google.com \
    --cc=casey@schaufler-ca.com \
    --cc=ccaulfie@redhat.com \
    --cc=cl@gentwo.org \
    --cc=clm@fb.com \
    --cc=cm224.lee@samsung.com \
    --cc=davem@davemloft.net \
    --cc=deller@gmx.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jaegeuk@kernel.org \
    --cc=jbacik@fb.com \
    --cc=jejb@parisc-linux.org \
    --cc=jlbec@evilplan.org \
    --cc=joro@8bytes.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=mpm@selenic.com \
    --cc=paulus@samba.org \
    --cc=penberg@kernel.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=stefanr@s5r6.in-berlin.de \
    --cc=swhiteho@redhat.com \
    --cc=teigland@redhat.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox