[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250307032530.116837-1-hanchunchao@inspur.com>
Date: Fri, 7 Mar 2025 11:25:28 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <broonie@...nel.org>, <mcoquelin.stm32@...il.com>,
<alexandre.torgue@...s.st.com>, <patrice.chotard@...s.st.com>
CC: <linux-spi@...r.kernel.org>, <linux-stm32@...md-mailman.stormreply.com>,
<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
Charles Han <hanchunchao@...pur.com>
Subject: [PATCH] spi: stm32: Fix a NULL vs IS_ERR() bug
The devm_ioremap() function doesn't return error pointers, it may
returns NULL. Update the error checking to match.
Fixes: 79b8a705e26c ("spi: stm32: Add OSPI driver")
Signed-off-by: Charles Han <hanchunchao@...pur.com>
---
drivers/spi/spi-stm32-ospi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
index 8eadcb64f34a..a544d7897edf 100644
--- a/drivers/spi/spi-stm32-ospi.c
+++ b/drivers/spi/spi-stm32-ospi.c
@@ -835,10 +835,10 @@ static int stm32_ospi_get_resources(struct platform_device *pdev)
if (rmem) {
ospi->mm_size = rmem->size;
ospi->mm_base = devm_ioremap(dev, rmem->base, rmem->size);
- if (IS_ERR(ospi->mm_base)) {
+ if (!ospi->mm_base) {
dev_err(dev, "unable to map memory region: %pa+%pa\n",
&rmem->base, &rmem->size);
- ret = PTR_ERR(ospi->mm_base);
+ ret = -ENOMEM;
goto err_dma;
}
--
2.43.0
Powered by blists - more mailing lists