diff options
author | Wei Yongjun <weiyj.lk@gmail.com> | 2013-06-20 23:24:27 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2013-06-24 16:52:22 -0400 |
commit | 80b15043e3450e730d30b71c099ab00d75a551ce (patch) | |
tree | 49e9af32bad895b76c64711ec6d5274fe4c34cdb /drivers/infiniband | |
parent | f29fa1cf340e21085672ccfeb6d66f292208567e (diff) |
IB/core: Fix error return code in add_port()
Fix to return -ENOMEM in the add_port() error handling case instead of
0, as done elsewhere in this function.
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/sysfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 246fdc151652..d9b78c4d0aad 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c | |||
@@ -545,8 +545,10 @@ static int add_port(struct ib_device *device, int port_num, | |||
545 | 545 | ||
546 | p->gid_group.name = "gids"; | 546 | p->gid_group.name = "gids"; |
547 | p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); | 547 | p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); |
548 | if (!p->gid_group.attrs) | 548 | if (!p->gid_group.attrs) { |
549 | ret = -ENOMEM; | ||
549 | goto err_remove_pma; | 550 | goto err_remove_pma; |
551 | } | ||
550 | 552 | ||
551 | ret = sysfs_create_group(&p->kobj, &p->gid_group); | 553 | ret = sysfs_create_group(&p->kobj, &p->gid_group); |
552 | if (ret) | 554 | if (ret) |
@@ -555,8 +557,10 @@ static int add_port(struct ib_device *device, int port_num, | |||
555 | p->pkey_group.name = "pkeys"; | 557 | p->pkey_group.name = "pkeys"; |
556 | p->pkey_group.attrs = alloc_group_attrs(show_port_pkey, | 558 | p->pkey_group.attrs = alloc_group_attrs(show_port_pkey, |
557 | attr.pkey_tbl_len); | 559 | attr.pkey_tbl_len); |
558 | if (!p->pkey_group.attrs) | 560 | if (!p->pkey_group.attrs) { |
561 | ret = -ENOMEM; | ||
559 | goto err_remove_gid; | 562 | goto err_remove_gid; |
563 | } | ||
560 | 564 | ||
561 | ret = sysfs_create_group(&p->kobj, &p->pkey_group); | 565 | ret = sysfs_create_group(&p->kobj, &p->pkey_group); |
562 | if (ret) | 566 | if (ret) |