diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2018-05-29 14:56:19 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-08-06 16:24:31 +0200 |
commit | ded30c95e8588ccdd9f281f36c0d37d7d030ef9d (patch) | |
tree | b776fbc8228a03d96526761ac50dca09cf8bc58c | |
parent | b5145f8b3506ad25b4c31970057fabca1543b325 (diff) | |
download | linux-stable-ded30c95e8588ccdd9f281f36c0d37d7d030ef9d.tar.gz linux-stable-ded30c95e8588ccdd9f281f36c0d37d7d030ef9d.tar.bz2 linux-stable-ded30c95e8588ccdd9f281f36c0d37d7d030ef9d.zip |
RDMA/mad: Convert BUG_ONs to error flows
[ Upstream commit 2468b82d69e3a53d024f28d79ba0fdb8bf43dfbf ]
Let's perform checks in-place instead of BUG_ONs.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/infiniband/core/mad.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c index 8d84c563ba75..616173b7a5e8 100644 --- a/drivers/infiniband/core/mad.c +++ b/drivers/infiniband/core/mad.c @@ -1548,7 +1548,8 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, mad_reg_req->oui, 3)) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(!*method); + if (!*method) + goto error3; goto check_in_use; } } @@ -1558,10 +1559,12 @@ static int add_oui_reg_req(struct ib_mad_reg_req *mad_reg_req, vclass]->oui[i])) { method = &(*vendor_table)->vendor_class[ vclass]->method_table[i]; - BUG_ON(*method); /* Allocate method table for this OUI */ - if ((ret = allocate_method_table(method))) - goto error3; + if (!*method) { + ret = allocate_method_table(method); + if (ret) + goto error3; + } memcpy((*vendor_table)->vendor_class[vclass]->oui[i], mad_reg_req->oui, 3); goto check_in_use; |