From ba48380260f68324635d7176860e6daadde53acf Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Mon, 16 Jun 2025 01:40:24 -0700 Subject: [PATCH] radv: free up hwvulkan_device_t upon driver unloading Per , the hw_device_t::close() function is called upon driver unloading. The behavior has been like this since Android 10. Reviewed-by: Samuel Pitoiset Acked-by: Rob Clark Part-of: --- src/amd/vulkan/radv_android.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/amd/vulkan/radv_android.c b/src/amd/vulkan/radv_android.c index eb7226a8c85..e77e48dc683 100644 --- a/src/amd/vulkan/radv_android.c +++ b/src/amd/vulkan/radv_android.c @@ -93,8 +93,13 @@ radv_hal_open(const struct hw_module_t *mod, const char *id, struct hw_device_t static int radv_hal_close(struct hw_device_t *dev) { - /* hwvulkan.h claims that hw_device_t::close() is never called. */ - return -1; + /* the hw_device_t::close() function is called upon driver unloading */ + assert(dev->version == HWVULKAN_DEVICE_API_VERSION_0_1); + assert(dev->module == &HAL_MODULE_INFO_SYM.common); + + hwvulkan_device_t *hal_dev = container_of(dev, hwvulkan_device_t, common); + free(hal_dev); + return 0; } VkResult