LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
* [patch] powerpc/fsl_rio: fix a missing error code
@ 2016-08-04  5:35 Dan Carpenter
  2016-08-04 20:16 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-08-04  5:35 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Paul Mackerras, Michael Ellerman, Alexandre Bounine,
	Andrew Morton, linuxppc-dev, kernel-janitors

We should set the error code here.  Otherwise static checkers complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 984e816..68e7c0d 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -491,6 +491,7 @@ int fsl_rio_setup(struct platform_device *dev)
 	rmu_node = of_parse_phandle(dev->dev.of_node, "fsl,srio-rmu-handle", 0);
 	if (!rmu_node) {
 		dev_err(&dev->dev, "No valid fsl,srio-rmu-handle property\n");
+		rc = -ENOENT;
 		goto err_rmu;
 	}
 	rc = of_address_to_resource(rmu_node, 0, &rmu_regs);

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

* Re: [patch] powerpc/fsl_rio: fix a missing error code
  2016-08-04  5:35 [patch] powerpc/fsl_rio: fix a missing error code Dan Carpenter
@ 2016-08-04 20:16 ` Andrew Morton
  2016-08-05 20:28   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2016-08-04 20:16 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Alexandre Bounine, linuxppc-dev, kernel-janitors

On Thu, 4 Aug 2016 08:35:25 +0300 Dan Carpenter <dan.carpenter@oracle.com> wrote:

> We should set the error code here.  Otherwise static checkers complain.
> 

hm.

> --- a/arch/powerpc/sysdev/fsl_rio.c
> +++ b/arch/powerpc/sysdev/fsl_rio.c
> @@ -491,6 +491,7 @@ int fsl_rio_setup(struct platform_device *dev)
>  	rmu_node = of_parse_phandle(dev->dev.of_node, "fsl,srio-rmu-handle", 0);
>  	if (!rmu_node) {
>  		dev_err(&dev->dev, "No valid fsl,srio-rmu-handle property\n");
> +		rc = -ENOENT;
>  		goto err_rmu;
>  	}
>  	rc = of_address_to_resource(rmu_node, 0, &rmu_regs);

afaict the function will return 0 in this case, which is a flat out
bug.  But why do static checkers complain?  The code will return a
suitably initialized value?

IOW, please always quote the checker/compiler output when fixing a bug!

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

* Re: [patch] powerpc/fsl_rio: fix a missing error code
  2016-08-04 20:16 ` Andrew Morton
@ 2016-08-05 20:28   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-08-05 20:28 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Alexandre Bounine, linuxppc-dev, kernel-janitors

On Thu, Aug 04, 2016 at 01:16:00PM -0700, Andrew Morton wrote:
> On Thu, 4 Aug 2016 08:35:25 +0300 Dan Carpenter <dan.carpenter@oracle.com> wrote:
> 
> > We should set the error code here.  Otherwise static checkers complain.
> > 
> 
> hm.
> 
> > --- a/arch/powerpc/sysdev/fsl_rio.c
> > +++ b/arch/powerpc/sysdev/fsl_rio.c
> > @@ -491,6 +491,7 @@ int fsl_rio_setup(struct platform_device *dev)
> >  	rmu_node = of_parse_phandle(dev->dev.of_node, "fsl,srio-rmu-handle", 0);
> >  	if (!rmu_node) {
> >  		dev_err(&dev->dev, "No valid fsl,srio-rmu-handle property\n");
> > +		rc = -ENOENT;
> >  		goto err_rmu;
> >  	}
> >  	rc = of_address_to_resource(rmu_node, 0, &rmu_regs);
> 
> afaict the function will return 0 in this case, which is a flat out
> bug.  But why do static checkers complain?  The code will return a
> suitably initialized value?
> 
> IOW, please always quote the checker/compiler output when fixing a bug!

Coccinelle has a check for missing error codes and I'm working on one
for Smatch as well.

regards,
dan carpenter

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-04  5:35 [patch] powerpc/fsl_rio: fix a missing error code Dan Carpenter
2016-08-04 20:16 ` Andrew Morton
2016-08-05 20:28   ` Dan Carpenter

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git