diff options
Diffstat (limited to 'drivers/accel/habanalabs/common/memory_mgr.c')
| -rw-r--r-- | drivers/accel/habanalabs/common/memory_mgr.c | 15 | 
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/accel/habanalabs/common/memory_mgr.c b/drivers/accel/habanalabs/common/memory_mgr.c index 0f2759e26547..c4d84df355b0 100644 --- a/drivers/accel/habanalabs/common/memory_mgr.c +++ b/drivers/accel/habanalabs/common/memory_mgr.c @@ -275,7 +275,7 @@ int hl_mem_mgr_mmap(struct hl_mem_mgr *mmg, struct vm_area_struct *vma,  	if (atomic_cmpxchg(&buf->mmap, 0, 1)) {  		dev_err(mmg->dev, -			"%s, Memory mmap failed, already mmaped to user\n", +			"%s, Memory mmap failed, already mapped to user\n",  			buf->behavior->topic);  		rc = -EINVAL;  		goto put_mem; @@ -341,8 +341,19 @@ void hl_mem_mgr_fini(struct hl_mem_mgr *mmg)  				"%s: Buff handle %u for CTX is still alive\n",  				topic, id);  	} +} -	/* TODO: can it happen that some buffer is still in use at this point? */ +/** + * hl_mem_mgr_idr_destroy() - destroy memory manager IDR. + * @mmg: parent unified memory manager + * + * Destroy the memory manager IDR. + * Shall be called when IDR is empty and no memory buffers are in use. + */ +void hl_mem_mgr_idr_destroy(struct hl_mem_mgr *mmg) +{ +	if (!idr_is_empty(&mmg->handles)) +		dev_crit(mmg->dev, "memory manager IDR is destroyed while it is not empty!\n");  	idr_destroy(&mmg->handles);  }  |