diff options
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index d7d502dd741e..b224079d4e1f 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -359,12 +359,14 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, | |||
359 | int use_lowmem, int use_coherent) | 359 | int use_lowmem, int use_coherent) |
360 | { | 360 | { |
361 | struct mthca_icm_table *table; | 361 | struct mthca_icm_table *table; |
362 | int obj_per_chunk; | ||
362 | int num_icm; | 363 | int num_icm; |
363 | unsigned chunk_size; | 364 | unsigned chunk_size; |
364 | int i; | 365 | int i; |
365 | u8 status; | 366 | u8 status; |
366 | 367 | ||
367 | num_icm = (obj_size * nobj + MTHCA_TABLE_CHUNK_SIZE - 1) / MTHCA_TABLE_CHUNK_SIZE; | 368 | obj_per_chunk = MTHCA_TABLE_CHUNK_SIZE / obj_size; |
369 | num_icm = DIV_ROUND_UP(nobj, obj_per_chunk); | ||
368 | 370 | ||
369 | table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL); | 371 | table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL); |
370 | if (!table) | 372 | if (!table) |