You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2024/10/05 15:05:22 UTC

(nuttx) 03/08: pci/ivshmem: Check drv isn't NULL before calling remove

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 0f918c8d4d0391e0048f9d37855a09e92a78880b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Oct 5 19:14:36 2024 +0800

    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 <xi...@xiaomi.com>
---
 drivers/pci/pci_ivshmem.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci_ivshmem.c b/drivers/pci/pci_ivshmem.c
index e3bd75c279..46bc3bfc14 100644
--- a/drivers/pci/pci_ivshmem.c
+++ b/drivers/pci/pci_ivshmem.c
@@ -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;
 }