pci/ivshmem: Check drv 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:
Xiang Xiao 2024-10-05 19:14:36 +08:00 committed by Alan C. Assis
parent 2aaaa7632f
commit 0f918c8d4d

View file

@ -187,8 +187,11 @@ static int ivshmem_unregister_device(FAR struct ivshmem_device_s *dev)
* the device unmatched
*/
dev->drv->remove(dev);
dev->drv = NULL;
if (dev->drv)
{
dev->drv->remove(dev);
}
return ret;
}