[PATCH] PCI/P2PDMA: Use RCU_INIT_POINTER() to clear pdev->p2pdma
From: lirongqing
Date: Fri Jun 12 2026 - 04:35:31 EST
From: Li RongQing <lirongqing@xxxxxxxxx>
Since pdev->p2pdma is an RCU-protected pointer, directly assigning
NULL to it violates RCU semantics and triggers sparse static analysis
warnings.
Fix this by using RCU_INIT_POINTER() instead of a raw assignment,
ensuring proper RCU annotations and consistency with the subsequent
synchronize_rcu() call.
Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
---
drivers/pci/p2pdma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 7c89854..fd986242 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -236,7 +236,7 @@ static void pci_p2pdma_release(void *data)
return;
/* Flush and disable pci_alloc_p2p_mem() */
- pdev->p2pdma = NULL;
+ RCU_INIT_POINTER(pdev->p2pdma, NULL);
if (p2pdma->pool)
synchronize_rcu();
xa_destroy(&p2pdma->map_types);
--
2.9.4