mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] spi: stm32-ospi: Fix an IS_ERR() vs NULL bug in stm32_ospi_get_resources()
@ 2025-03-06  9:48 Dan Carpenter
  2025-03-06 10:26 ` Patrice CHOTARD
  2025-03-06 16:10 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2025-03-06  9:48 UTC (permalink / raw)
  To: Patrice Chotard
  Cc: Mark Brown, Maxime Coquelin, Alexandre Torgue, linux-spi,
	linux-stm32, linux-arm-kernel, linux-kernel, kernel-janitors

The devm_ioremap() function returns NULL on error, it doesn't return
error pointers.  Fix the check to match.

Fixes: 79b8a705e26c ("spi: stm32: Add OSPI driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 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.47.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-06 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-06  9:48 [PATCH next] spi: stm32-ospi: Fix an IS_ERR() vs NULL bug in stm32_ospi_get_resources() Dan Carpenter
2025-03-06 10:26 ` Patrice CHOTARD
2025-03-06 16:10 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®