linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe
@ 2020-03-12 11:31 Dan Carpenter
  2020-03-12 11:58 ` Adam Ford
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-03-12 11:31 UTC (permalink / raw)
  To: Yogesh Gaur, Han Xu, Adam Ford
  Cc: Ashish Kumar, Mark Brown, linux-spi, kernel-janitors

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

Fixes: d166a73503ef ("spi: fspi: dynamically alloc AHB memory")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
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(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 019f40e2917c..1ccda82da206 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -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

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

* Re: [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe
  2020-03-12 11:31 [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe Dan Carpenter
@ 2020-03-12 11:58 ` Adam Ford
       [not found]   ` <CAHCN7xKSc7spZyq=mySWHDmSrGMkQo8FYRbn-NzYRa7iB-0BoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2020-03-12 12:11 ` Fabio Estevam
  2020-03-12 16:52 ` Applied "spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe" to the spi tree Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Adam Ford @ 2020-03-12 11:58 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Yogesh Gaur, Han Xu, Ashish Kumar, Mark Brown, linux-spi,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Thu, Mar 12, 2020 at 6:32 AM Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote:
>
> The platform_get_resource_byname() function returns NULL on error, it
> doesn't return error pointers.
>
> Fixes: d166a73503ef ("spi: fspi: dynamically alloc AHB memory")
> Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> ---
> 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

>
>  drivers/spi/spi-nxp-fspi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
> index 019f40e2917c..1ccda82da206 100644
> --- a/drivers/spi/spi-nxp-fspi.c
> +++ b/drivers/spi/spi-nxp-fspi.c
> @@ -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
>

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

* Re: [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe
  2020-03-12 11:31 [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe Dan Carpenter
  2020-03-12 11:58 ` Adam Ford
@ 2020-03-12 12:11 ` Fabio Estevam
  2020-03-12 12:18   ` Mark Brown
  2020-03-12 16:52 ` Applied "spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe" to the spi tree Mark Brown
  2 siblings, 1 reply; 7+ messages in thread
From: Fabio Estevam @ 2020-03-12 12:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Yogesh Gaur, Han Xu, Adam Ford, Ashish Kumar, Mark Brown,
	linux-spi, kernel-janitors

Hi Dan,

On Thu, Mar 12, 2020 at 8:33 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> The platform_get_resource_byname() function returns NULL on error, it
> doesn't return error pointers.
>
> Fixes: d166a73503ef ("spi: fspi: dynamically alloc AHB memory")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> 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

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

* Re: [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe
  2020-03-12 12:11 ` Fabio Estevam
@ 2020-03-12 12:18   ` Mark Brown
       [not found]     ` <VI1PR04MB4015D509DC78B0C7EA649CC995FA0@VI1PR04MB4015.eurprd04.prod.outlook.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Brown @ 2020-03-12 12:18 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Dan Carpenter, Yogesh Gaur, Han Xu, Adam Ford, Ashish Kumar,
	linux-spi, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 590 bytes --]

On Thu, Mar 12, 2020 at 09:11:44AM -0300, Fabio Estevam wrote:
> On Thu, Mar 12, 2020 at 8:33 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> > 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Applied "spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe" to the spi tree
  2020-03-12 11:31 [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe Dan Carpenter
  2020-03-12 11:58 ` Adam Ford
  2020-03-12 12:11 ` Fabio Estevam
@ 2020-03-12 16:52 ` Mark Brown
  2 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-03-12 16:52 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Adam Ford, Ashish Kumar, Han Xu,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-spi-u79uwXL29TY76Z2rM5mHXA, Mark Brown, Yogesh Gaur

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 <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
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")
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Link: https://lore.kernel.org/r/20200312113154.GC20562@mwanda
Signed-off-by: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
 drivers/spi/spi-nxp-fspi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 019f40e2917c..1ccda82da206 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -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

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

* Re: [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe
       [not found]   ` <CAHCN7xKSc7spZyq=mySWHDmSrGMkQo8FYRbn-NzYRa7iB-0BoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-03-12 17:47     ` Dan Carpenter
  0 siblings, 0 replies; 7+ messages in thread
From: Dan Carpenter @ 2020-03-12 17:47 UTC (permalink / raw)
  To: Adam Ford
  Cc: Yogesh Gaur, Han Xu, Ashish Kumar, Mark Brown, linux-spi,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

On Thu, Mar 12, 2020 at 06:58:31AM -0500, Adam Ford wrote:
> On Thu, Mar 12, 2020 at 6:32 AM Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> wrote:
> >
> > The platform_get_resource_byname() function returns NULL on error, it
> > doesn't return error pointers.
> >
> > Fixes: d166a73503ef ("spi: fspi: dynamically alloc AHB memory")
> > Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > ---
> > 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.

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

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

* Re: [EXT] Re: [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe
       [not found]     ` <VI1PR04MB4015D509DC78B0C7EA649CC995FA0@VI1PR04MB4015.eurprd04.prod.outlook.com>
@ 2020-03-13 11:54       ` Mark Brown
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2020-03-13 11:54 UTC (permalink / raw)
  To: Ashish Kumar
  Cc: Fabio Estevam, Dan Carpenter, Yogesh Gaur, Han Xu, Adam Ford,
	linux-spi, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

On Fri, Mar 13, 2020 at 04:16:44AM +0000, Ashish Kumar wrote:

> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2020-03-13 11:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 11:31 [PATCH] spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe Dan Carpenter
2020-03-12 11:58 ` Adam Ford
     [not found]   ` <CAHCN7xKSc7spZyq=mySWHDmSrGMkQo8FYRbn-NzYRa7iB-0BoQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-03-12 17:47     ` Dan Carpenter
2020-03-12 12:11 ` Fabio Estevam
2020-03-12 12:18   ` Mark Brown
     [not found]     ` <VI1PR04MB4015D509DC78B0C7EA649CC995FA0@VI1PR04MB4015.eurprd04.prod.outlook.com>
2020-03-13 11:54       ` [EXT] " Mark Brown
2020-03-12 16:52 ` Applied "spi: spi-nxp-fspi: Fix a NULL vs IS_ERR() check in probe" to the spi tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).