public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: rdreier@cisco.com
Cc: sean.hefty@intel.com, hal.rosenstock@gmail.com,
	general@lists.openfabrics.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] fix return value in ib_device_register_sysfs()
Date: Fri, 15 Feb 2008 10:24:49 +0800	[thread overview]
Message-ID: <47B4F7F1.1090002@cn.fujitsu.com> (raw)

Set ret to -ENOMEM when kobject_create_and_add() returns NULL.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>

---
 drivers/infiniband/core/sysfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c
index c864ef7..5a4b2e6 100644
--- a/drivers/infiniband/core/sysfs.c
+++ b/drivers/infiniband/core/sysfs.c
@@ -686,8 +686,10 @@ int ib_device_register_sysfs(struct ib_device *device)
 
 	device->ports_parent = kobject_create_and_add("ports",
 					kobject_get(&class_dev->kobj));
-	if (!device->ports_parent)
+	if (!device->ports_parent) {
+		ret = -ENOMEM;
 		goto err_put;
+	}
 
 	if (device->node_type == RDMA_NODE_IB_SWITCH) {
 		ret = add_port(device, 0);
-- 
1.5.4.rc3


             reply	other threads:[~2008-02-15  2:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15  2:24 Li Zefan [this message]
2008-02-15  5:13 ` [PATCH] fix return value in ib_device_register_sysfs() Roland Dreier
2008-02-15  5:21   ` Li Zefan

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=47B4F7F1.1090002@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=general@lists.openfabrics.org \
    --cc=hal.rosenstock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=sean.hefty@intel.com \
    /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