This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/13.0 by this push:
new 3c05de7273b drivers: pci: Fix EPF debug assertions
3c05de7273b is described below
commit 3c05de7273b793390db55b01ff4c49514fe28037
Author: Old-Ding <[email protected]>
AuthorDate: Mon Jul 6 05:32:43 2026 +0800
drivers: pci: Fix EPF debug assertions
pci_epf_device_register() and pci_epf_unregister_driver() used || in
DEBUGASSERT expressions that validate a pointer and a required field or
callback. If the pointer is NULL, the right-hand side dereferences it; if the
pointer is valid but the required member is NULL, the assertion passes.
Require both conditions in each assertion so the debug checks match the
preconditions used later in the functions.
Generated-by: OpenAI Codex
Signed-off-by: Old-Ding <[email protected]>
---
drivers/pci/pci_epf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci_epf.c b/drivers/pci/pci_epf.c
index 269a6c5e4cd..a7c92867ebc 100644
--- a/drivers/pci/pci_epf.c
+++ b/drivers/pci/pci_epf.c
@@ -298,7 +298,7 @@ int pci_epf_device_register(FAR struct pci_epf_device_s
*epf)
FAR struct pci_epc_ctrl_s *epc;
int ret;
- DEBUGASSERT(epf != NULL || epf->name != NULL);
+ DEBUGASSERT(epf != NULL && epf->name != NULL);
ret = nxmutex_lock(&g_pci_epf_lock);
if (ret < 0)
@@ -499,7 +499,7 @@ int pci_epf_unregister_driver(FAR struct pci_epf_driver_s
*drv)
FAR struct pci_epf_device_s *epf;
int ret;
- DEBUGASSERT(drv != NULL || drv->remove != NULL);
+ DEBUGASSERT(drv != NULL && drv->remove != NULL);
ret = nxmutex_lock(&g_pci_epf_lock);
if (ret < 0)