diff mbox series

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

Message ID ca14e566-d9b7-471d-b738-56dd697b1417@moroto.mountain (mailing list archive)
State Accepted
Delegated to: Lorenzo Pieralisi
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(-)

Comments

Manivannan Sadhasivam June 9, 2023, 3:54 p.m. UTC | #1
On Fri, Jun 09, 2023 at 01:50:09PM +0300, Dan Carpenter wrote:
> 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>

Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>

- Mani

> ---
>  drivers/pci/endpoint/functions/pci-epf-mhi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 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) {
> -- 
> 2.39.2
>
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) {