* [PATCH] spi: stm32: Fix a NULL vs IS_ERR() bug
@ 2025-03-07 3:25 Charles Han
2025-03-07 8:59 ` Patrice CHOTARD
0 siblings, 1 reply; 3+ messages in thread
From: Charles Han @ 2025-03-07 3:25 UTC (permalink / raw)
To: broonie, mcoquelin.stm32, alexandre.torgue, patrice.chotard
Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel,
Charles Han
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@inspur.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
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] spi: stm32: Fix a NULL vs IS_ERR() bug
2025-03-07 3:25 [PATCH] spi: stm32: Fix a NULL vs IS_ERR() bug Charles Han
@ 2025-03-07 8:59 ` Patrice CHOTARD
2025-03-07 13:24 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Patrice CHOTARD @ 2025-03-07 8:59 UTC (permalink / raw)
To: Charles Han, broonie, mcoquelin.stm32, alexandre.torgue
Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel
On 3/7/25 04:25, Charles Han wrote:
> 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@inspur.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;
> }
>
Hi
No need to copy/paste other contributor's patch by just swapping some
words in title/commit message.
This fix has already sent By Dan Carpenter and merged.
Patrice
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] spi: stm32: Fix a NULL vs IS_ERR() bug
2025-03-07 8:59 ` Patrice CHOTARD
@ 2025-03-07 13:24 ` Mark Brown
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2025-03-07 13:24 UTC (permalink / raw)
To: Patrice CHOTARD
Cc: Charles Han, mcoquelin.stm32, alexandre.torgue, linux-spi,
linux-stm32, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 757 bytes --]
On Fri, Mar 07, 2025 at 09:59:42AM +0100, Patrice CHOTARD wrote:
> On 3/7/25 04:25, Charles Han wrote:
> > The devm_ioremap() function doesn't return error pointers, it may
> > returns NULL. Update the error checking to match.
> No need to copy/paste other contributor's patch by just swapping some
> words in title/commit message.
> This fix has already sent By Dan Carpenter and merged.
No idea if it applies here or not but since a lot of Dan's work is based
on static checker results it's quite common to see duplicates of his
patches when someone else runs the same or similar checkers - I think
all the people running these checkers are aware this happens but often
figure it's easier to send the duplicates than to check -next.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-07 13:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 3:25 [PATCH] spi: stm32: Fix a NULL vs IS_ERR() bug Charles Han
2025-03-07 8:59 ` Patrice CHOTARD
2025-03-07 13:24 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.