common/mlx5: fix default devargs initialization
[dpdk.git] / drivers / common / mlx5 / mlx5_common_mr.c
index c694aaf..fa27bd9 100644 (file)
@@ -516,8 +516,7 @@ mlx5_mr_free(struct mlx5_mr *mr, mlx5_dereg_mr_t dereg_mr_cb)
                return;
        DRV_LOG(DEBUG, "freeing MR(%p):", (void *)mr);
        dereg_mr_cb(&mr->pmd_mr);
-       if (mr->ms_bmp != NULL)
-               rte_bitmap_free(mr->ms_bmp);
+       rte_bitmap_free(mr->ms_bmp);
        mlx5_free(mr);
 }
 
@@ -1541,7 +1540,7 @@ mlx5_mempool_reg_create(struct rte_mempool *mp, unsigned int mrs_n,
  * Destroy a mempool registration object.
  *
  * @param standalone
- *   Whether @p mpr owns its MRs excludively, i.e. they are not shared.
+ *   Whether @p mpr owns its MRs exclusively, i.e. they are not shared.
  */
 static void
 mlx5_mempool_reg_destroy(struct mlx5_mr_share_cache *share_cache,
@@ -1834,12 +1833,13 @@ mlx5_mempool_reg_addr2mr(struct mlx5_mempool_reg *mpr, uintptr_t addr,
 
        for (i = 0; i < mpr->mrs_n; i++) {
                const struct mlx5_pmd_mr *mr = &mpr->mrs[i].pmd_mr;
-               uintptr_t mr_addr = (uintptr_t)mr->addr;
+               uintptr_t mr_start = (uintptr_t)mr->addr;
+               uintptr_t mr_end = mr_start + mr->len;
 
-               if (mr_addr <= addr) {
+               if (mr_start <= addr && addr < mr_end) {
                        lkey = rte_cpu_to_be_32(mr->lkey);
-                       entry->start = mr_addr;
-                       entry->end = mr_addr + mr->len;
+                       entry->start = mr_start;
+                       entry->end = mr_end;
                        entry->lkey = lkey;
                        break;
                }