linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 12/14] drivers/spi/spi-coldfire-qspi.c: fix error return code
       [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
@ 2012-08-19  8:44   ` Julia Lawall
  2012-08-19  8:44   ` [PATCH 11/14] drivers/spi/spi-orion.c: " Julia Lawall
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

---
 drivers/spi/spi-coldfire-qspi.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-coldfire-qspi.c b/drivers/spi/spi-coldfire-qspi.c
index b2d4b9e..7889796 100644
--- a/drivers/spi/spi-coldfire-qspi.c
+++ b/drivers/spi/spi-coldfire-qspi.c
@@ -462,6 +462,7 @@ static int __devinit mcfqspi_probe(struct platform_device *pdev)
 	pdata = pdev->dev.platform_data;
 	if (!pdata) {
 		dev_dbg(&pdev->dev, "platform data is missing\n");
+		status = -EINVAL;
 		goto fail4;
 	}
 	master->bus_num = pdata->bus_num;


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

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

* [PATCH 11/14] drivers/spi/spi-orion.c: fix error return code
       [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
  2012-08-19  8:44   ` [PATCH 12/14] drivers/spi/spi-coldfire-qspi.c: fix error return code Julia Lawall
@ 2012-08-19  8:44   ` Julia Lawall
  2012-08-19  8:44   ` [PATCH 10/14] drivers/spi/spi-ep93xx.c: " Julia Lawall
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

---
Actually, orion_spi_reset currently always returns 0, so the test is
never true.  Perhaps this should be taken into account in some other way.

 drivers/spi/spi-orion.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c
index b17c09c..cc12803 100644
--- a/drivers/spi/spi-orion.c
+++ b/drivers/spi/spi-orion.c
@@ -435,7 +435,8 @@ static int __init orion_spi_probe(struct platform_device *pdev)
 	}
 	spi->base = ioremap(r->start, SZ_1K);
 
-	if (orion_spi_reset(spi) < 0)
+	status = orion_spi_reset(spi);
+	if (status < 0)
 		goto out_rel_mem;
 
 	master->dev.of_node = pdev->dev.of_node;


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

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

* [PATCH 10/14] drivers/spi/spi-ep93xx.c: fix error return code
       [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
  2012-08-19  8:44   ` [PATCH 12/14] drivers/spi/spi-coldfire-qspi.c: fix error return code Julia Lawall
  2012-08-19  8:44   ` [PATCH 11/14] drivers/spi/spi-orion.c: " Julia Lawall
@ 2012-08-19  8:44   ` Julia Lawall
  2012-08-22 16:12     ` H Hartley Sweeten
  2012-08-19  8:44   ` [PATCH 9/14] drivers/spi/spi-omap-100k.c: " Julia Lawall
  2012-08-19  8:44   ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: " Julia Lawall
  4 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

---
 drivers/spi/spi-ep93xx.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index f97f1d2..9e7fdfd 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -1105,6 +1105,7 @@ static int __devinit ep93xx_spi_probe(struct platform_device *pdev)
 	espi->wq = create_singlethread_workqueue("ep93xx_spid");
 	if (!espi->wq) {
 		dev_err(&pdev->dev, "unable to create workqueue\n");
+		error = -ENOMEM;
 		goto fail_free_dma;
 	}
 	INIT_WORK(&espi->msg_work, ep93xx_spi_work);


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

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

* [PATCH 9/14] drivers/spi/spi-omap-100k.c: fix error return code
       [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
                     ` (2 preceding siblings ...)
  2012-08-19  8:44   ` [PATCH 10/14] drivers/spi/spi-ep93xx.c: " Julia Lawall
@ 2012-08-19  8:44   ` Julia Lawall
  2012-08-19  8:44   ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: " Julia Lawall
  4 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: Grant Likely
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

---
Actually, omap1_spi100k_reset currently always returns 0, so the test is
never true.  Perhaps this should be taken into account in some other way.

 drivers/spi/spi-omap-100k.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-omap-100k.c b/drivers/spi/spi-omap-100k.c
index 9bd1c92..b581107 100644
--- a/drivers/spi/spi-omap-100k.c
+++ b/drivers/spi/spi-omap-100k.c
@@ -542,7 +542,8 @@ static int __devinit omap1_spi100k_probe(struct platform_device *pdev)
 		goto err2;
 	}
 
-	if (omap1_spi100k_reset(spi100k) < 0)
+	status = omap1_spi100k_reset(spi100k);
+	if (status < 0)
 		goto err3;
 
 	status = spi_register_master(master);


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

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

* [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
       [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
                     ` (3 preceding siblings ...)
  2012-08-19  8:44   ` [PATCH 9/14] drivers/spi/spi-omap-100k.c: " Julia Lawall
@ 2012-08-19  8:44   ` Julia Lawall
  2012-08-22  9:38     ` Kukjin Kim
  4 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2012-08-19  8:44 UTC (permalink / raw)
  To: Ben Dooks
  Cc: linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Kukjin Kim,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

From: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall-L2FTfq7BK8M@public.gmane.org>

---
Perhaps -EINVAL is not the right value in this case.

 drivers/spi/spi-s3c24xx.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
index 8ee7d79..a2a080b 100644
--- a/drivers/spi/spi-s3c24xx.c
+++ b/drivers/spi/spi-s3c24xx.c
@@ -611,6 +611,7 @@ static int __devinit s3c24xx_spi_probe(struct platform_device *pdev)
 	if (!pdata->set_cs) {
 		if (pdata->pin_cs < 0) {
 			dev_err(&pdev->dev, "No chipselect pin\n");
+			err = -EINVAL;
 			goto err_register;
 		}
 


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

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

* RE: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
  2012-08-19  8:44   ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: " Julia Lawall
@ 2012-08-22  9:38     ` Kukjin Kim
  2012-08-22 11:40       ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Kukjin Kim @ 2012-08-22  9:38 UTC (permalink / raw)
  To: 'Julia Lawall', 'Ben Dooks'
  Cc: kernel-janitors, 'Grant Likely', linux-arm-kernel,
	linux-samsung-soc, spi-devel-general, linux-kernel,
	'Mark Brown'

Julia Lawall wrote:
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Initialize return variable before exiting on an error path.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> (
> if@p1 (\(ret < 0\|ret != 0\))
>  { ... return ret; }
> |
> ret@p1 = 0
> )
> ... when != ret = e1
>     when != &ret
> *if(...)
> {
>   ... when != ret = e2
>       when forall
>  return ret;
> }
> 
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
Acked-by: Kukjin Kim <kgene.kim@samsung.com>

(Cc'ed Mark Brown who is handling spi for a moment)

> ---
> Perhaps -EINVAL is not the right value in this case.
> 
Well, if (pin_cs < 0) is true, it is really invalid value. So I think, it
makes sense :-)

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

>  drivers/spi/spi-s3c24xx.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
> index 8ee7d79..a2a080b 100644
> --- a/drivers/spi/spi-s3c24xx.c
> +++ b/drivers/spi/spi-s3c24xx.c
> @@ -611,6 +611,7 @@ static int __devinit s3c24xx_spi_probe(struct
> platform_device *pdev)
>  	if (!pdata->set_cs) {
>  		if (pdata->pin_cs < 0) {
>  			dev_err(&pdev->dev, "No chipselect pin\n");
> +			err = -EINVAL;
>  			goto err_register;
>  		}
> 

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

* Re: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
  2012-08-22  9:38     ` Kukjin Kim
@ 2012-08-22 11:40       ` Mark Brown
  2012-08-22 11:42         ` Julia Lawall
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2012-08-22 11:40 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: 'Julia Lawall', 'Ben Dooks', kernel-janitors,
	'Grant Likely', linux-arm-kernel, linux-samsung-soc,
	spi-devel-general, linux-kernel

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

On Wed, Aug 22, 2012 at 06:38:36PM +0900, Kukjin Kim wrote:
> Julia Lawall wrote:

> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

> Acked-by: Kukjin Kim <kgene.kim@samsung.com>

> (Cc'ed Mark Brown who is handling spi for a moment)

Please resend the patch to me so I can apply this.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
  2012-08-22 11:40       ` Mark Brown
@ 2012-08-22 11:42         ` Julia Lawall
  2012-08-22 17:00           ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2012-08-22 11:42 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kukjin Kim, 'Julia Lawall', 'Ben Dooks',
	kernel-janitors, 'Grant Likely', linux-arm-kernel,
	linux-samsung-soc, spi-devel-general, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
Perhaps -EINVAL is not the right value in this case.

 drivers/spi/spi-s3c24xx.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c
index 8ee7d79..a2a080b 100644
--- a/drivers/spi/spi-s3c24xx.c
+++ b/drivers/spi/spi-s3c24xx.c
@@ -611,6 +611,7 @@ static int __devinit s3c24xx_spi_probe(struct platform_device *pdev)
 	if (!pdata->set_cs) {
 		if (pdata->pin_cs < 0) {
 			dev_err(&pdev->dev, "No chipselect pin\n");
+			err = -EINVAL;
 			goto err_register;
 		}

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

* RE: [PATCH 10/14] drivers/spi/spi-ep93xx.c: fix error return code
  2012-08-19  8:44   ` [PATCH 10/14] drivers/spi/spi-ep93xx.c: " Julia Lawall
@ 2012-08-22 16:12     ` H Hartley Sweeten
  0 siblings, 0 replies; 10+ messages in thread
From: H Hartley Sweeten @ 2012-08-22 16:12 UTC (permalink / raw)
  To: Julia Lawall, Grant Likely
  Cc: spi-devel-general@lists.sourceforge.net,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org

On Sunday, August 19, 2012 1:44 AM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Initialize return variable before exiting on an error path.

<snip>

> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
>  drivers/spi/spi-ep93xx.c |    1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
> index f97f1d2..9e7fdfd 100644
> --- a/drivers/spi/spi-ep93xx.c
> +++ b/drivers/spi/spi-ep93xx.c
> @@ -1105,6 +1105,7 @@ static int __devinit ep93xx_spi_probe(struct platform_device *pdev)
>  	espi->wq = create_singlethread_workqueue("ep93xx_spid");
>  	if (!espi->wq) {
>  		dev_err(&pdev->dev, "unable to create workqueue\n");
> +		error = -ENOMEM;
>  		goto fail_free_dma;
>  	}
>  	INIT_WORK(&espi->msg_work, ep93xx_spi_work);

Looks ok to me... Thanks!

Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>

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

* Re: [PATCH 14/14] drivers/spi/spi-s3c24xx.c: fix error return code
  2012-08-22 11:42         ` Julia Lawall
@ 2012-08-22 17:00           ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2012-08-22 17:00 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Kukjin Kim, 'Ben Dooks', kernel-janitors,
	'Grant Likely', linux-arm-kernel, linux-samsung-soc,
	spi-devel-general, linux-kernel

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

On Wed, Aug 22, 2012 at 01:42:47PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Initialize return variable before exiting on an error path.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-08-22 17:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1345365870-29831-1-git-send-email-Julia.Lawall@lip6.fr>
     [not found] ` <1345365870-29831-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2012-08-19  8:44   ` [PATCH 12/14] drivers/spi/spi-coldfire-qspi.c: fix error return code Julia Lawall
2012-08-19  8:44   ` [PATCH 11/14] drivers/spi/spi-orion.c: " Julia Lawall
2012-08-19  8:44   ` [PATCH 10/14] drivers/spi/spi-ep93xx.c: " Julia Lawall
2012-08-22 16:12     ` H Hartley Sweeten
2012-08-19  8:44   ` [PATCH 9/14] drivers/spi/spi-omap-100k.c: " Julia Lawall
2012-08-19  8:44   ` [PATCH 14/14] drivers/spi/spi-s3c24xx.c: " Julia Lawall
2012-08-22  9:38     ` Kukjin Kim
2012-08-22 11:40       ` Mark Brown
2012-08-22 11:42         ` Julia Lawall
2012-08-22 17:00           ` 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).