summaryrefslogtreecommitdiff
path: root/drivers/infiniband/hw/ocrdma
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2019-10-29 08:27:40 +0200
committerJason Gunthorpe <jgg@mellanox.com>2019-11-06 16:00:06 -0400
commit84b56d57cf3cc9640b69cbb3a5d023d010ccb62a (patch)
tree1ad288c4b46027b2500f4831ff89bc9d354ed549 /drivers/infiniband/hw/ocrdma
parentdd0b0159f7b31439679879fcf2574d7ad744b6f1 (diff)
RDMA/ocrdma: Simplify process_mad function
Change the switch with one case into a simple if statement so the code is less confusing. Link: https://lore.kernel.org/r/20191029062745.7932-12-leon@kernel.org Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/hw/ocrdma')
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_ah.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
index 0dc74ef42f8c..4098508b9240 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
@@ -256,20 +256,16 @@ int ocrdma_process_mad(struct ib_device *ibdev,
struct ib_mad_hdr *out, size_t *out_mad_size,
u16 *out_mad_pkey_index)
{
- int status;
+ int status = IB_MAD_RESULT_SUCCESS;
struct ocrdma_dev *dev;
const struct ib_mad *in_mad = (const struct ib_mad *)in;
struct ib_mad *out_mad = (struct ib_mad *)out;
- switch (in_mad->mad_hdr.mgmt_class) {
- case IB_MGMT_CLASS_PERF_MGMT:
+ if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {
dev = get_ocrdma_dev(ibdev);
ocrdma_pma_counters(dev, out_mad);
- status = IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY;
- break;
- default:
- status = IB_MAD_RESULT_SUCCESS;
- break;
+ status |= IB_MAD_RESULT_REPLY;
}
+
return status;
}