Skip to contentSkip to conversation

PCI: endpoint: pci-ep-msi: Fix NULL vs IS_ERR() check in pci_epf_write_msi_msg()

PATCH Applied Dan Carpenter 3 participants 3 messages Aug 1, 2025 – Aug 11, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: endpoint: pci-ep-msi: Fix NULL vs IS_ERR() check in pci_epf_write_msi_msg()

The pci_epc_get() function returns error pointers. It never returns NULL. Update the check to match.

Fixes 1c3b002c6bf6 ("PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller")
---
 drivers/pci/endpoint/pci-ep-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/pci-ep-msi.c +1 -1
index 9ca89cbfec15..1b58357b905f 100644
@@ -24,7 +24,7 @@ static void pci_epf_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
 	struct pci_epf *epf;
 
 	epc = pci_epc_get(dev_name(msi_desc_to_dev(desc)));
-	if (!epc)
+	if (IS_ERR(epc))
 		return;
 
 	epf = list_first_entry_or_null(&epc->pci_epf, struct pci_epf, list);
Signature · 1 line
2.47.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Dan Carpenter

The pci_epc_get() function returns error pointers. It never returns NULL. Update the check to match.

Fixes 1c3b002c6bf6 ("PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller")
Quoted 20 lines
---
 drivers/pci/endpoint/pci-ep-msi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/pci-ep-msi.c +1 -2
index 9ca89cbfec15..1b58357b905f 100644
@@ -24,7 +24,7 @@ static void pci_epf_write_msi_msg(struct msi_desc *desc, struct msi_msg *msg)
 	struct pci_epf *epf;
 
 	epc = pci_epc_get(dev_name(msi_desc_to_dev(desc)));
-	if (!epc)
+	if (IS_ERR(epc))
 		return;
 
 	epf = list_first_entry_or_null(&epc->pci_epf, struct pci_epf, list);
--

2.47.2

maintainer Applied
#2 lore raw
In reply to Dan Carpenter
Quoted 4 lines · Dan Carpenter

The pci_epc_get() function returns error pointers. It never returns NULL. Update the check to match.

Applied, thanks!

[1/1] PCI: endpoint: pci-ep-msi: Fix NULL vs IS_ERR() check in pci_epf_write_msi_msg()

      commit: 57a75fa9d56e310e883e4377205690e88c05781b

Best regards,

Signature · 1 line
Manivannan Sadhasivam <[email protected]>