diff options
author | Ira Weiny <iweiny@gmail.com> | 2015-11-21 00:43:47 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-12-21 21:48:27 (GMT) |
commit | 4be81991ec5f21a9dcf4b951689d81cc1b03ca25 (patch) | |
tree | 537552f298844dc50812e7b152a661106cf2587a | |
parent | 9d2f53ef42c15f6e47b48246beb0a32c4ff3b3ed (diff) | |
download | linux-4be81991ec5f21a9dcf4b951689d81cc1b03ca25.tar.xz |
staging/rdma/hfi1: Eliminate WARN_ON when VL is invalid
sdma_select_engine_vl only needs to protect itself from an invalid VL.
Something higher up the stack should be warning the user when they try
to use an SL which maps to an invalid VL.
Reviewed-by: Dean Luick <dean.luick@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Ira Weiny <iweiny@gmail.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/rdma/hfi1/sdma.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/staging/rdma/hfi1/sdma.c b/drivers/staging/rdma/hfi1/sdma.c index 90b7072..0710e2a 100644 --- a/drivers/staging/rdma/hfi1/sdma.c +++ b/drivers/staging/rdma/hfi1/sdma.c @@ -765,8 +765,14 @@ struct sdma_engine *sdma_select_engine_vl( struct sdma_map_elem *e; struct sdma_engine *rval; - if (WARN_ON(vl > 8)) - return &dd->per_sdma[0]; + /* NOTE This should only happen if SC->VL changed after the initial + * checks on the QP/AH + * Default will return engine 0 below + */ + if (vl >= num_vls) { + rval = NULL; + goto done; + } rcu_read_lock(); m = rcu_dereference(dd->sdma_map); @@ -778,6 +784,7 @@ struct sdma_engine *sdma_select_engine_vl( rval = e->sde[selector & e->mask]; rcu_read_unlock(); +done: rval = !rval ? &dd->per_sdma[0] : rval; trace_hfi1_sdma_engine_select(dd, selector, vl, rval->this_idx); return rval; |