LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] fix return value in ib_device_register_sysfs()
@ 2008-02-15  2:24 Li Zefan
  2008-02-15  5:13 ` Roland Dreier
  0 siblings, 1 reply; 3+ messages in thread
From: Li Zefan @ 2008-02-15  2:24 UTC (permalink / raw)
  To: rdreier; +Cc: sean.hefty, hal.rosenstock, general, LKML

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix return value in ib_device_register_sysfs()
  2008-02-15  2:24 [PATCH] fix return value in ib_device_register_sysfs() Li Zefan
@ 2008-02-15  5:13 ` Roland Dreier
  2008-02-15  5:21   ` Li Zefan
  0 siblings, 1 reply; 3+ messages in thread
From: Roland Dreier @ 2008-02-15  5:13 UTC (permalink / raw)
  To: Li Zefan; +Cc: sean.hefty, hal.rosenstock, general, LKML

Wow, good catch.  How did you find this bug?

Anyway, thanks, applied.

 - R.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix return value in ib_device_register_sysfs()
  2008-02-15  5:13 ` Roland Dreier
@ 2008-02-15  5:21   ` Li Zefan
  0 siblings, 0 replies; 3+ messages in thread
From: Li Zefan @ 2008-02-15  5:21 UTC (permalink / raw)
  To: Roland Dreier; +Cc: sean.hefty, hal.rosenstock, general, LKML

Roland Dreier wrote:
> Wow, good catch.  How did you find this bug?
> 

Just by accident, when I glanced down the code. ;)

> Anyway, thanks, applied.
> 
>  - R.
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-15  5:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-15  2:24 [PATCH] fix return value in ib_device_register_sysfs() Li Zefan
2008-02-15  5:13 ` Roland Dreier
2008-02-15  5:21   ` Li Zefan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).