The hfi_destroy function is called too early in remove method. It
destroys a mutex which is used later in the .remove from pmruntime.
Solve the issue by moving hfi_destroy after last usage of the mutex.
Signed-off-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
        ret = hfi_core_deinit(core, true);
        WARN_ON(ret);
 
-       hfi_destroy(core);
        venus_shutdown(core);
        of_platform_depopulate(dev);
 
        if (pm_ops->core_put)
                pm_ops->core_put(dev);
 
+       hfi_destroy(core);
+
        icc_put(core->video_path);
        icc_put(core->cpucfg_path);