IB/hfi1: Check for error on call to alloc_rsm_map_table
The call to alloc_rsm_map_table does not check if the kmalloc fails.
Check for a NULL on alloc, and bail if it fails.
Fixes: 372cc85a13
("IB/hfi1: Extract RSM map table init from QOS")
Link: https://lore.kernel.org/r/20190715164521.74174.27047.stgit@awfm-01.aw.intel.com
Cc: <stable@vger.kernel.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: John Fleck <john.fleck@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
60c3becfd1
commit
cd48a82087
@@ -14452,7 +14452,7 @@ void hfi1_deinit_vnic_rsm(struct hfi1_devdata *dd)
|
|||||||
clear_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK);
|
clear_rcvctrl(dd, RCV_CTRL_RCV_RSM_ENABLE_SMASK);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_rxe(struct hfi1_devdata *dd)
|
static int init_rxe(struct hfi1_devdata *dd)
|
||||||
{
|
{
|
||||||
struct rsm_map_table *rmt;
|
struct rsm_map_table *rmt;
|
||||||
u64 val;
|
u64 val;
|
||||||
@@ -14461,6 +14461,9 @@ static void init_rxe(struct hfi1_devdata *dd)
|
|||||||
write_csr(dd, RCV_ERR_MASK, ~0ull);
|
write_csr(dd, RCV_ERR_MASK, ~0ull);
|
||||||
|
|
||||||
rmt = alloc_rsm_map_table(dd);
|
rmt = alloc_rsm_map_table(dd);
|
||||||
|
if (!rmt)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
/* set up QOS, including the QPN map table */
|
/* set up QOS, including the QPN map table */
|
||||||
init_qos(dd, rmt);
|
init_qos(dd, rmt);
|
||||||
init_fecn_handling(dd, rmt);
|
init_fecn_handling(dd, rmt);
|
||||||
@@ -14487,6 +14490,7 @@ static void init_rxe(struct hfi1_devdata *dd)
|
|||||||
val |= ((4ull & RCV_BYPASS_HDR_SIZE_MASK) <<
|
val |= ((4ull & RCV_BYPASS_HDR_SIZE_MASK) <<
|
||||||
RCV_BYPASS_HDR_SIZE_SHIFT);
|
RCV_BYPASS_HDR_SIZE_SHIFT);
|
||||||
write_csr(dd, RCV_BYPASS, val);
|
write_csr(dd, RCV_BYPASS, val);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init_other(struct hfi1_devdata *dd)
|
static void init_other(struct hfi1_devdata *dd)
|
||||||
@@ -15024,7 +15028,10 @@ int hfi1_init_dd(struct hfi1_devdata *dd)
|
|||||||
goto bail_cleanup;
|
goto bail_cleanup;
|
||||||
|
|
||||||
/* set initial RXE CSRs */
|
/* set initial RXE CSRs */
|
||||||
init_rxe(dd);
|
ret = init_rxe(dd);
|
||||||
|
if (ret)
|
||||||
|
goto bail_cleanup;
|
||||||
|
|
||||||
/* set initial TXE CSRs */
|
/* set initial TXE CSRs */
|
||||||
init_txe(dd);
|
init_txe(dd);
|
||||||
/* set initial non-RXE, non-TXE CSRs */
|
/* set initial non-RXE, non-TXE CSRs */
|
||||||
|
Reference in New Issue
Block a user