Skip to contentSkip to conversation

spi: spi-fsl-qspi: Fix return value check in fsl_qspi_probe()

PATCH Superseded Wei Yongjun 4 participants 5 messages Apr 21, 2020 – Apr 22, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-fsl-qspi: Fix return value check in fsl_qspi_probe()

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 858e26a515c2 ("spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size")
---
 drivers/spi/spi-fsl-qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-fsl-qspi.c +2 -2
index 83eb8a484faf..6766262d7e75 100644
@@ -880,8 +880,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
 	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
 				   (q->devtype_data->ahb_buf_size * 4));
-	if (IS_ERR(q->ahb_addr)) {
-		ret = PTR_ERR(q->ahb_addr);
+	if (!q->ahb_addr) {
+		ret = -ENOMEM;
 		goto err_put_ctrl;
 	}
 
Reviewed-by on v1 1/1
#1 lore raw

Hi Wei Yongjun,

Quoted 9 lines

-----Original Message-----
From: Wei Yongjun <[email protected]>
Sent: Tuesday, April 21, 2020 3:09 PM
To: Han Xu <[email protected]>; Mark Brown <[email protected]>; Ashish Kumar <[email protected]>
Cc: Wei Yongjun <[email protected]>; [email protected]; [email protected]
Subject: [PATCH -next] spi: spi-fsl-qspi: Fix return value check in fsl_qspi_probe()

It sound like all return value in probe() is fixed.
Please reword this commit message like this:
spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe()

Quoted 17 lines

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 858e26a515c2 ("spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times

AHB buffer size")

---
 drivers/spi/spi-fsl-qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-fsl-qspi.c index renamed from drivers/spi/spi-fsl-qspi.c +0 -0

83eb8a484faf..6766262d7e75 100644

drivers/spi/spi-fsl-qspi.c static int fsl_qspi_probe(struct platform_device · line 885

Quoted 8 lines
drivers/spi/spi-fsl-qspi.c +2 -2
@@ -880,8 +880,8 @@ static int fsl_qspi_probe(struct platform_device
 *pdev)
 	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
 	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
 				   (q->devtype_data->ahb_buf_size * 4));
-	if (IS_ERR(q->ahb_addr)) {
-		ret = PTR_ERR(q->ahb_addr);
+	if (!q->ahb_addr) {
+		ret = -ENOMEM;

Thanks & Regards
Ashish

Quoted 4 lines
drivers/spi/spi-fsl-qspi.c +0 -0
 		goto err_put_ctrl;
 	}
#2 lore raw

PATCH v2 1/1 spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe

In reply to Wei Yongjun

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 858e26a515c2 ("spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size")

---
v1 -> v2: fix the subject as Ashish's suggest

---
 drivers/spi/spi-fsl-qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-fsl-qspi.c +2 -2
index 83eb8a484faf..6766262d7e75 100644
@@ -880,8 +880,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
 	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
 				   (q->devtype_data->ahb_buf_size * 4));
-	if (IS_ERR(q->ahb_addr)) {
-		ret = PTR_ERR(q->ahb_addr);
+	if (!q->ahb_addr) {
+		ret = -ENOMEM;
 		goto err_put_ctrl;
 	}
 
maintainer Acked-by on v2 1/1
#3 lore raw

RE: [PATCH -next v2] spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe

Quoted 12 lines

-----Original Message-----
From: Wei Yongjun <[email protected]>
Sent: Tuesday, April 21, 2020 8:46 PM
To: Han Xu <[email protected]>; Mark Brown <[email protected]>; Ashish Kumar <[email protected]>
Cc: Wei Yongjun <[email protected]>; [email protected]; kernel- [email protected]
Subject: [PATCH -next v2] spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe

Quoted 8 lines

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 858e26a515c2 ("spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB

buffer size")

Quoted 22 lines

---
v1 -> v2: fix the subject as Ashish's suggest

---
 drivers/spi/spi-fsl-qspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-fsl-qspi.c index renamed from drivers/spi/spi-fsl-qspi.c +0 -0

83eb8a484faf..6766262d7e75 100644

drivers/spi/spi-fsl-qspi.c +2 -2
@@ -880,8 +880,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 	/* Since there are 4 cs, map size required is 4 times ahb_buf_size */
 	q->ahb_addr = devm_ioremap(dev, q->memmap_phy,
 				   (q->devtype_data->ahb_buf_size * 4));
-	if (IS_ERR(q->ahb_addr)) {
-		ret = PTR_ERR(q->ahb_addr);
+	if (!q->ahb_addr) {
+		ret = -ENOMEM;
 		goto err_put_ctrl;
 	}
 
maintainer
#4 lore raw

Re: [PATCH -next v2] spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe

In reply to Wei Yongjun
Quoted 10 lines · Wei Yongjun

In case of error, the function devm_ioremap() returns NULL pointer not ERR_PTR(). The IS_ERR() test in the return value check should be replaced with NULL test.

Fixes 858e26a515c2 ("spi: spi-fsl-qspi: Reduce devm_ioremap size to 4 times AHB buffer size")

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.8

Thanks!

[1/1] spi: spi-fsl-qspi: Fix return value check of devm_ioremap() in probe

      commit: f58dcab68aa57e74c12c9bec7ff1bb73e0b35143

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark