diff mbox series

[2/2] PCI: endpoint: Fix an IS_ERR() vs NULL bug

Message ID ca14e566-d9b7-471d-b738-56dd697b1417@moroto.mountain
State New
Headers show
Series [1/2] PCI: endpoint: Check correct variable in __pci_epf_mhi_alloc_map() | expand

Commit Message

Dan Carpenter June 9, 2023, 10:50 a.m. UTC
The ioremap() function does not return error pointers, it returns NULL
on error.

Fixes: 7db424a84d96 ("PCI: endpoint: Add PCI Endpoint function driver for MHI bus")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/pci/endpoint/functions/pci-epf-mhi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/endpoint/functions/pci-epf-mhi.c b/drivers/pci/endpoint/functions/pci-epf-mhi.c
index e7d64b9d12ff..b45db923306b 100644
--- a/drivers/pci/endpoint/functions/pci-epf-mhi.c
+++ b/drivers/pci/endpoint/functions/pci-epf-mhi.c
@@ -354,8 +354,8 @@  static int pci_epf_mhi_bind(struct pci_epf *epf)
 	epf_mhi->mmio_size = resource_size(res);
 
 	epf_mhi->mmio = ioremap(epf_mhi->mmio_phys, epf_mhi->mmio_size);
-	if (IS_ERR(epf_mhi->mmio))
-		return PTR_ERR(epf_mhi->mmio);
+	if (!epf_mhi->mmio)
+		return -ENOMEM;
 
 	ret = platform_get_irq_byname(pdev, "doorbell");
 	if (ret < 0) {