Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI/P2PDMA: Use RCU_INIT_POINTER() to clear pdev->p2pdma
@ 2026-06-12  8:34 lirongqing
  2026-06-12  8:48 ` sashiko-bot
  0 siblings, 1 reply; 3+ messages in thread
From: lirongqing @ 2026-06-12  8:34 UTC (permalink / raw)
  To: Bjorn Helgaas, kwilczynski, linux-pci, linux-kernel; +Cc: Li RongQing

From: Li RongQing <lirongqing@baidu.com>

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@baidu.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-16 18:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12  8:34 [PATCH] PCI/P2PDMA: Use RCU_INIT_POINTER() to clear pdev->p2pdma lirongqing
2026-06-12  8:48 ` sashiko-bot
2026-06-16 18:57   ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox