Skip to content

Commit 189318d

Browse files
author
Rob VanReenen
committed
Fix updatable driver loading issue with Vulkan.
When unloading Vulkan driver, check if close() function is non-NULL before calling it. Bug: 349287141 Change-Id: I1e6c3c80e57dceecd41888541044807e1dab45af
1 parent 45ccd13 commit 189318d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

vulkan/libvulkan/driver.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,13 @@ void Hal::UnloadBuiltinDriver() {
339339

340340
ALOGD("Unload builtin Vulkan driver.");
341341

342-
// Close the opened device
343-
int err = hal_.dev_->common.close(
344-
const_cast<struct hw_device_t*>(&hal_.dev_->common));
345-
ALOG_ASSERT(!err, "hw_device_t::close() failed.");
342+
if (hal_.dev_->common.close != nullptr)
343+
{
344+
// Close the opened device
345+
int err = hal_.dev_->common.close(
346+
const_cast<struct hw_device_t*>(&hal_.dev_->common));
347+
ALOG_ASSERT(!err, "hw_device_t::close() failed.");
348+
}
346349

347350
// Close the opened shared library in the hw_module_t
348351
android_unload_sphal_library(hal_.dev_->common.module->dso);

0 commit comments

Comments
 (0)