diff options
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_memfree.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 637b30e35592..6d3b05dd9e3f 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -179,9 +179,14 @@ out: | |||
179 | 179 | ||
180 | void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj) | 180 | void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj) |
181 | { | 181 | { |
182 | int i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE; | 182 | int i; |
183 | u8 status; | 183 | u8 status; |
184 | 184 | ||
185 | if (!mthca_is_memfree(dev)) | ||
186 | return; | ||
187 | |||
188 | i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE; | ||
189 | |||
185 | down(&table->mutex); | 190 | down(&table->mutex); |
186 | 191 | ||
187 | if (--table->icm[i]->refcount == 0) { | 192 | if (--table->icm[i]->refcount == 0) { |
@@ -256,6 +261,9 @@ void mthca_table_put_range(struct mthca_dev *dev, struct mthca_icm_table *table, | |||
256 | { | 261 | { |
257 | int i; | 262 | int i; |
258 | 263 | ||
264 | if (!mthca_is_memfree(dev)) | ||
265 | return; | ||
266 | |||
259 | for (i = start; i <= end; i += MTHCA_TABLE_CHUNK_SIZE / table->obj_size) | 267 | for (i = start; i <= end; i += MTHCA_TABLE_CHUNK_SIZE / table->obj_size) |
260 | mthca_table_put(dev, table, i); | 268 | mthca_table_put(dev, table, i); |
261 | } | 269 | } |