mirror of
https://github.com/apache/nuttx.git
synced 2025-01-13 09:49:21 +08:00
driver/virtio: Check driver isn't NULL before calling remove
since the device mayn't bind to the driver yet Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
bad1627759
commit
347c2dae29
1 changed files with 5 additions and 5 deletions
|
@ -364,12 +364,12 @@ int virtio_unregister_device(FAR struct virtio_device *device)
|
|||
container_of(node, struct virtio_device_item_s, node);
|
||||
if (item->device == device)
|
||||
{
|
||||
/* Call driver remove and mark item->driver NULL to indicate
|
||||
* the device unmatched
|
||||
*/
|
||||
/* Call driver remove */
|
||||
|
||||
item->driver->remove(device);
|
||||
item->driver = NULL;
|
||||
if (item->driver)
|
||||
{
|
||||
item->driver->remove(device);
|
||||
}
|
||||
|
||||
/* Remove the device from the device list and free memory */
|
||||
|
||||
|
|
Loading…
Reference in a new issue