2012-09-17 17:28:25

by Peter Senna Tschudin

[permalink] [raw]
Subject: [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code

From: Peter Senna Tschudin <[email protected]>

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>
(
[email protected] (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
[email protected] = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>

Signed-off-by: Peter Senna Tschudin <[email protected]>
---
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


2012-09-17 17:28:26

by Peter Senna Tschudin

[permalink] [raw]
Subject: [PATCH 2/4] drivers/crypto/hifn_795x.c: fix error return code

From: Peter Senna Tschudin <[email protected]>

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>
(
[email protected] (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
[email protected] = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>

Signed-off-by: Peter Senna Tschudin <[email protected]>
---
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

2012-09-17 17:28:28

by Peter Senna Tschudin

[permalink] [raw]
Subject: [PATCH 4/4] drivers/crypto/tegra-aes.c: fix error return code

From: Peter Senna Tschudin <[email protected]>

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>
(
[email protected] (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
[email protected] = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>

Signed-off-by: Peter Senna Tschudin <[email protected]>
---
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

2012-09-17 17:28:27

by Peter Senna Tschudin

[permalink] [raw]
Subject: [PATCH 3/4] drivers/crypto/amcc/crypto4xx_core.c: fix error return code

From: Peter Senna Tschudin <[email protected]>

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>
(
[email protected] (\(ret < 0\|ret != 0\))
{ ... return ret; }
|
[email protected] = 0
)
... when != ret = e1
when != &ret
*if(...)
{
... when != ret = e2
when forall
return ret;
}
// </smpl>

Signed-off-by: Peter Senna Tschudin <[email protected]>
---
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

2012-09-24 12:15:06

by Arun Murthy

[permalink] [raw]
Subject: Re: [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code

On Mon, Sep 17, 2012 at 10:58 PM, Peter Senna Tschudin
<[email protected]> wrote:
> From: Peter Senna Tschudin <[email protected]>
>
> 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>
> (
> [email protected] (\(ret < 0\|ret != 0\))
> { ... return ret; }
> |
> [email protected] = 0
> )
> ... when != ret = e1
> when != &ret
> *if(...)
> {
> ... when != ret = e2
> when forall
> return ret;
> }
> // </smpl>
>
> Signed-off-by: Peter Senna Tschudin <[email protected]>

Reviewed-by: Arun Murthy <[email protected]>

2012-09-27 05:44:12

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH 1/4] drivers/crypto/ux500/cryp/cryp_core.c: fix error return code

On Mon, Sep 17, 2012 at 07:28:25PM +0200, Peter Senna Tschudin wrote:
> From: Peter Senna Tschudin <[email protected]>
>
> 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 <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt