linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code
@ 2012-09-17 17:28 Peter Senna Tschudin
  2012-09-17 17:28 ` [PATCH 2/4] drivers/crypto/hifn_795x.c: " Peter Senna Tschudin
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-09-17 17:28 UTC (permalink / raw)
  To: herbert
  Cc: davem, linus.walleij, andreas.westin, rjw, peter.senna,
	linux-crypto, linux-kernel, kernel-janitors

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/crypto/ux500/cryp/cryp_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/ux500/cryp/cryp_core.c b/drivers/crypto/ux500/cryp/cryp_core.c
index 1c307e1..715c0fe 100644
--- a/drivers/crypto/ux500/cryp/cryp_core.c
+++ b/drivers/crypto/ux500/cryp/cryp_core.c
@@ -1486,6 +1486,7 @@ static int ux500_cryp_probe(struct platform_device *pdev)
 	if (!res_irq) {
 		dev_err(dev, "[%s]: IORESOURCE_IRQ unavailable",
 			__func__);
+		ret = -ENODEV;
 		goto out_power;
 	}
 
-- 
1.7.11.4


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

* [PATCH 2/4] drivers/crypto/hifn_795x.c: fix error return code
  2012-09-17 17:28 [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code Peter Senna Tschudin
@ 2012-09-17 17:28 ` Peter Senna Tschudin
  2012-09-17 17:28 ` [PATCH 3/4] drivers/crypto/amcc/crypto4xx_core.c: " Peter Senna Tschudin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-09-17 17:28 UTC (permalink / raw)
  To: herbert
  Cc: davem, linux-crypto, linux-kernel, kernel-janitors, Peter Senna Tschudin

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/crypto/hifn_795x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/hifn_795x.c b/drivers/crypto/hifn_795x.c
index df14358..fda3296 100644
--- a/drivers/crypto/hifn_795x.c
+++ b/drivers/crypto/hifn_795x.c
@@ -2611,14 +2611,17 @@ static int __devinit hifn_probe(struct pci_dev *pdev, const struct pci_device_id
 		size = pci_resource_len(pdev, i);
 
 		dev->bar[i] = ioremap_nocache(addr, size);
-		if (!dev->bar[i])
+		if (!dev->bar[i]) {
+			err = -ENOMEM;
 			goto err_out_unmap_bars;
+		}
 	}
 
 	dev->desc_virt = pci_alloc_consistent(pdev, sizeof(struct hifn_dma),
 			&dev->desc_dma);
 	if (!dev->desc_virt) {
 		dprintk("Failed to allocate descriptor rings.\n");
+		err = -ENOMEM;
 		goto err_out_unmap_bars;
 	}
 	memset(dev->desc_virt, 0, sizeof(struct hifn_dma));
-- 
1.7.11.4


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

* [PATCH 3/4] drivers/crypto/amcc/crypto4xx_core.c: fix error return code
  2012-09-17 17:28 [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code Peter Senna Tschudin
  2012-09-17 17:28 ` [PATCH 2/4] drivers/crypto/hifn_795x.c: " Peter Senna Tschudin
@ 2012-09-17 17:28 ` Peter Senna Tschudin
  2012-09-17 17:28 ` [PATCH 4/4] drivers/crypto/tegra-aes.c: " Peter Senna Tschudin
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-09-17 17:28 UTC (permalink / raw)
  To: herbert
  Cc: davem, Julia.Lawall, vzapolskiy, axel.lin, peter.senna,
	linux-crypto, linux-kernel, kernel-janitors

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/crypto/amcc/crypto4xx_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 802e851..f88e3d8 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1226,6 +1226,7 @@ static int __init crypto4xx_probe(struct platform_device *ofdev)
 	core_dev->dev->ce_base = of_iomap(ofdev->dev.of_node, 0);
 	if (!core_dev->dev->ce_base) {
 		dev_err(dev, "failed to of_iomap\n");
+		rc = -ENOMEM;
 		goto err_iomap;
 	}
 
-- 
1.7.11.4


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

* [PATCH 4/4] drivers/crypto/tegra-aes.c: fix error return code
  2012-09-17 17:28 [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code Peter Senna Tschudin
  2012-09-17 17:28 ` [PATCH 2/4] drivers/crypto/hifn_795x.c: " Peter Senna Tschudin
  2012-09-17 17:28 ` [PATCH 3/4] drivers/crypto/amcc/crypto4xx_core.c: " Peter Senna Tschudin
@ 2012-09-17 17:28 ` Peter Senna Tschudin
  2012-09-24 12:01 ` [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: " Arun Murthy
  2012-09-27  5:43 ` Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Senna Tschudin @ 2012-09-17 17:28 UTC (permalink / raw)
  To: herbert
  Cc: davem, linux-crypto, linux-kernel, kernel-janitors, Peter Senna Tschudin

From: Peter Senna Tschudin <peter.senna@gmail.com>

Convert a nonnegative error return code to a negative one, as returned
elsewhere in the function.

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: Peter Senna Tschudin <peter.senna@gmail.com>
---
 drivers/crypto/tegra-aes.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/crypto/tegra-aes.c b/drivers/crypto/tegra-aes.c
index 631149e5..37185e6 100644
--- a/drivers/crypto/tegra-aes.c
+++ b/drivers/crypto/tegra-aes.c
@@ -969,6 +969,7 @@ static int tegra_aes_probe(struct platform_device *pdev)
 	aes_wq = alloc_workqueue("tegra_aes_wq", WQ_HIGHPRI | WQ_UNBOUND, 1);
 	if (!aes_wq) {
 		dev_err(dev, "alloc_workqueue failed\n");
+		err = -ENOMEM;
 		goto out;
 	}
 
-- 
1.7.11.4


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

* Re: [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code
  2012-09-17 17:28 [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code Peter Senna Tschudin
                   ` (2 preceding siblings ...)
  2012-09-17 17:28 ` [PATCH 4/4] drivers/crypto/tegra-aes.c: " Peter Senna Tschudin
@ 2012-09-24 12:01 ` Arun Murthy
  2012-09-27  5:43 ` Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Arun Murthy @ 2012-09-24 12:01 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: herbert, davem, linus.walleij, andreas.westin, rjw, linux-crypto,
	linux-kernel, kernel-janitors

On Mon, Sep 17, 2012 at 10:58 PM, Peter Senna Tschudin
<peter.senna@gmail.com> wrote:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
>
> Convert a nonnegative error return code to a negative one, as returned
> elsewhere in the function.
>
> 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: Peter Senna Tschudin <peter.senna@gmail.com>

Reviewed-by: Arun Murthy <arunrmurthy83@gmail.com>

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

* Re: [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code
  2012-09-17 17:28 [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code Peter Senna Tschudin
                   ` (3 preceding siblings ...)
  2012-09-24 12:01 ` [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: " Arun Murthy
@ 2012-09-27  5:43 ` Herbert Xu
  4 siblings, 0 replies; 6+ messages in thread
From: Herbert Xu @ 2012-09-27  5:43 UTC (permalink / raw)
  To: Peter Senna Tschudin
  Cc: davem, linus.walleij, andreas.westin, rjw, linux-crypto,
	linux-kernel, kernel-janitors

On Mon, Sep 17, 2012 at 07:28:25PM +0200, Peter Senna Tschudin wrote:
> From: Peter Senna Tschudin <peter.senna@gmail.com>
> 
> Convert a nonnegative error return code to a negative one, as returned
> elsewhere in the function.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)

All four patches applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2012-09-27  5:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17 17:28 [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code Peter Senna Tschudin
2012-09-17 17:28 ` [PATCH 2/4] drivers/crypto/hifn_795x.c: " Peter Senna Tschudin
2012-09-17 17:28 ` [PATCH 3/4] drivers/crypto/amcc/crypto4xx_core.c: " Peter Senna Tschudin
2012-09-17 17:28 ` [PATCH 4/4] drivers/crypto/tegra-aes.c: " Peter Senna Tschudin
2012-09-24 12:01 ` [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: " Arun Murthy
2012-09-27  5:43 ` Herbert Xu

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