[PATCH next] misc: cb710: Fix a NULL vs IS_ERR() check in probe()

Dan Carpenter posted 1 patch 3 months, 1 week ago
drivers/misc/cb710/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH next] misc: cb710: Fix a NULL vs IS_ERR() check in probe()
Posted by Dan Carpenter 3 months, 1 week ago
The pcim_iomap_region() function never returns NULL, it returns error
pointers.  Update the checking to match.

Fixes: b91c13534a63 ("misc: cb710: Replace deprecated PCI functions")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/misc/cb710/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index a1e6ba62c298..2dd212f04fed 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -226,8 +226,8 @@ static int cb710_probe(struct pci_dev *pdev,
 	spin_lock_init(&chip->irq_lock);
 	chip->pdev = pdev;
 	chip->iobase = pcim_iomap_region(pdev, 0, KBUILD_MODNAME);
-	if (!chip->iobase)
-		return -ENOMEM;
+	if (IS_ERR(chip->iobase))
+		return PTR_ERR(chip->iobase);
 
 	pci_set_drvdata(pdev, chip);
 
-- 
2.51.0
Re: [PATCH next] misc: cb710: Fix a NULL vs IS_ERR() check in probe()
Posted by Arnd Bergmann 3 months, 1 week ago
On Wed, Oct 29, 2025, at 14:13, Dan Carpenter wrote:
> The pcim_iomap_region() function never returns NULL, it returns error
> pointers.  Update the checking to match.
>
> Fixes: b91c13534a63 ("misc: cb710: Replace deprecated PCI functions")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

Acked-by: Arnd Bergmann <arnd@arndb.de>