Skip to contentSkip to conversation

spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe

PATCH In review Dan Carpenter 4 participants 7 messages Mar 12, 2020 – Mar 13, 2020 2 messages not in the archive

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

PATCH 1/1 spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe

The platform_get_resource_byname() function returns NULL on error, it doesn't return error pointers.

Fixes d166a73503ef ("spi: fspi: dynamically alloc AHB memory")

---
The commit message for commit d166a73503ef ("spi: fspi: dynamically alloc AHB memory") is not very good. Why is it necessary to allocate the AHB memory dynamically instead of during probe? Also I suspect that Adam should have recieved authorship credit for that patch.

 drivers/spi/spi-nxp-fspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-nxp-fspi.c +2 -2
index 019f40e2917c..1ccda82da206 100644
@@ -1019,8 +1019,8 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 
 	/* find the resources - controller memory mapped space */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fspi_mmap");
-	if (IS_ERR(res)) {
-		ret = PTR_ERR(res);
+	if (!res) {
+		ret = -ENODEV;
 		goto err_put_ctrl;
 	}
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 11 lines · Dan Carpenter

The platform_get_resource_byname() function returns NULL on error, it doesn't return error pointers.

Fixes d166a73503ef ("spi: fspi: dynamically alloc AHB memory")

---
The commit message for commit d166a73503ef ("spi: fspi: dynamically alloc AHB memory") is not very good. Why is it necessary to allocate the AHB memory dynamically instead of during probe? Also I suspect that Adam should have recieved authorship credit for that patch.

It wasn't my patch, I just pulled it in from NXP's repo. The true author is Han Xu. When I pulled in the series from NXP, I found the flexSPI on the i.MX8MM to become functional, and my company has a board with a qspi flash on it.

adam

Quoted 22 lines
 drivers/spi/spi-nxp-fspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-nxp-fspi.c +2 -3
index 019f40e2917c..1ccda82da206 100644
@@ -1019,8 +1019,8 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 
        /* find the resources - controller memory mapped space */
        res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fspi_mmap");
-       if (IS_ERR(res)) {
-               ret = PTR_ERR(res);
+       if (!res) {
+               ret = -ENODEV;
                goto err_put_ctrl;
        }
 
--

2.20.1

#4 lore raw
In reply to Dan Carpenter

Hi Dan,

Quoted 10 lines · Dan Carpenter

The platform_get_resource_byname() function returns NULL on error, it doesn't return error pointers.

Fixes d166a73503ef ("spi: fspi: dynamically alloc AHB memory")

---
The commit message for commit d166a73503ef ("spi: fspi: dynamically alloc AHB memory") is not very good. Why is it necessary to allocate the AHB memory dynamically instead of during probe? Also I suspect that

Agreed and I made the same comment during review:
https://patchwork.kernel.org/patch/11361581/

Thanks

maintainer
#5 lore raw
Quoted 8 lines · Fabio Estevam
Quoted 3 lines · Dan Carpenter

The commit message for commit d166a73503ef ("spi: fspi: dynamically alloc AHB memory") is not very good. Why is it necessary to allocate the AHB memory dynamically instead of during probe? Also I suspect that

Agreed and I made the same comment during review:
https://patchwork.kernel.org/patch/11361581/

Indeed. There had been an earlier discussion of what it was doing IIRC but it didn't make it's way into the changelog.

maintainer
#8 lore raw

Applied "spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe" to the spi tree

In reply to Dan Carpenter

The patch

spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe

has been applied to the spi tree at

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

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

From 1a421ebab6bb5bf65001743ba9fef48e94fb345a Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Thu, 12 Mar 2020 14:31:54 +0300
Subject: [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe

The platform_get_resource_byname() function returns NULL on error, it doesn't return error pointers.

Fixes d166a73503ef ("spi: fspi: dynamically alloc AHB memory")
---
 drivers/spi/spi-nxp-fspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-nxp-fspi.c +2 -2
index 019f40e2917c..1ccda82da206 100644
@@ -1019,8 +1019,8 @@ static int nxp_fspi_probe(struct platform_device *pdev)
 
 	/* find the resources - controller memory mapped space */
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "fspi_mmap");
-	if (IS_ERR(res)) {
-		ret = PTR_ERR(res);
+	if (!res) {
+		ret = -ENODEV;
 		goto err_put_ctrl;
 	}
 
Signature · 1 line
2.20.1
#3 lore raw
In reply to a message not in the archive
Quoted 13 lines · Adam Ford
Quoted 11 lines · Dan Carpenter

The platform_get_resource_byname() function returns NULL on error, it doesn't return error pointers.

Fixes d166a73503ef ("spi: fspi: dynamically alloc AHB memory")

---
The commit message for commit d166a73503ef ("spi: fspi: dynamically alloc AHB memory") is not very good. Why is it necessary to allocate the AHB memory dynamically instead of during probe? Also I suspect that Adam should have recieved authorship credit for that patch.

Quoted 4 lines

It wasn't my patch, I just pulled it in from NXP's repo. The true author is Han Xu. When I pulled in the series from NXP, I found the flexSPI on the i.MX8MM to become functional, and my company has a board with a qspi flash on it.

You should have put your Signed-off-by after Han Xu's. They should be in chronological order so whoever handles a patch adds their S-o-b to the end.

regards,
dan carpenter

maintainer
#7 lore raw
In reply to a message not in the archive
Quoted 5 lines · Ashish Kumar

This patch needs to drop, until further debugged, since flexspi is shared ip it is not having desired result on few boards, but it is needed for i.mx series, This is one of the comments from han xu. I believe further modifications will be needed, if not commit msg and other things can be update.

Please send a patch doing the revert with a changelog explaining why it's needed.

Please fix your mail client to word wrap within paragraphs at something substantially less than 80 columns. Doing this makes your messages much easier to read and reply to.