From: Leon Romanovsky <leonro@xxxxxxxxxxxx> Rewrite ocrdma implementation of process_mad in order to simplify code. Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> --- drivers/infiniband/hw/ocrdma/ocrdma_ah.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c index f8ebdf7086a1..4098508b9240 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c @@ -256,24 +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; - if (WARN_ON_ONCE(in_mad_size != sizeof(*in_mad) || - *out_mad_size != sizeof(*out_mad))) - return IB_MAD_RESULT_FAILURE; - - 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; } -- 2.20.1