driver/vhost: Check driver is NULL before calling probe

to avoid the same device bind to multiple drivers at the same time

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2024-10-05 20:05:50 +08:00 committed by Alan C. Assis
parent 1e823a077c
commit f914bc8ef2
1 changed files with 1 additions and 1 deletions

View File

@ -181,7 +181,7 @@ int vhost_register_driver(FAR struct vhost_driver *driver)
list_for_every_entry(&g_vhost_bus.device, item, struct vhost_device_item_s,
node)
{
if (driver->device == item->device->id.device)
if (item->driver == NULL && driver->device == item->device->id.device)
{
/* If found the device in the device list, call driver probe,
* if probe success, assign item->driver to indicate the device