Notify to the user that although he closed the FD, the device is
still in use because there are live CS and/or memory mappings (mmaps).
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
        kref_get(&hpriv->refcount);
 }
 
-void hl_hpriv_put(struct hl_fpriv *hpriv)
+int hl_hpriv_put(struct hl_fpriv *hpriv)
 {
-       kref_put(&hpriv->refcount, hpriv_release);
+       return kref_put(&hpriv->refcount, hpriv_release);
 }
 
 /*
        hl_cb_mgr_fini(hdev, &hpriv->cb_mgr);
        hl_ctx_mgr_fini(hdev, &hpriv->ctx_mgr);
 
-       hl_hpriv_put(hpriv);
+       if (!hl_hpriv_put(hpriv))
+               dev_warn(hdev->dev,
+                       "Device is still in use because there are live CS and/or memory mappings\n");
 
        return 0;
 }
 
 int hl_device_reset(struct hl_device *hdev, bool hard_reset,
                        bool from_hard_reset_thread);
 void hl_hpriv_get(struct hl_fpriv *hpriv);
-void hl_hpriv_put(struct hl_fpriv *hpriv);
+int hl_hpriv_put(struct hl_fpriv *hpriv);
 int hl_device_set_frequency(struct hl_device *hdev, enum hl_pll_frequency freq);
 uint32_t hl_device_utilization(struct hl_device *hdev, uint32_t period_ms);