diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-08-14 02:47:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-08-15 18:17:41 -0400 |
commit | dfdda5a0fa3f458e9807da1d1a1d2c56076d43e5 (patch) | |
tree | eb37c28094dcb7bce5c62c3aad117b7fc53c77f8 /drivers/usb/gadget/s3c-hsotg.c | |
parent | fd4d72cb0d31e13f0eb4c90c26580a5784c76527 (diff) |
drivers/usb/gadget/s3c-hsotg.c: fix error return code
Convert a 0 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>
@@
identifier ret;
expression e,e1,e2,e3,e4,x;
@@
(
if (\(ret != 0\|ret < 0\) || ...) { ... return ...; }
|
ret = 0
)
... when != ret = e1
*x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...);
... when != x = e2
when != ret = e3
*if (x == NULL || ...)
{
... when != ret = e4
* return ret;
}
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/s3c-hsotg.c')
-rw-r--r-- | drivers/usb/gadget/s3c-hsotg.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index b13e0bb5f5b8..0bb617e1dda2 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -3599,6 +3599,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev) | |||
3599 | 3599 | ||
3600 | if (hsotg->num_of_eps == 0) { | 3600 | if (hsotg->num_of_eps == 0) { |
3601 | dev_err(dev, "wrong number of EPs (zero)\n"); | 3601 | dev_err(dev, "wrong number of EPs (zero)\n"); |
3602 | ret = -EINVAL; | ||
3602 | goto err_supplies; | 3603 | goto err_supplies; |
3603 | } | 3604 | } |
3604 | 3605 | ||
@@ -3606,6 +3607,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev) | |||
3606 | GFP_KERNEL); | 3607 | GFP_KERNEL); |
3607 | if (!eps) { | 3608 | if (!eps) { |
3608 | dev_err(dev, "cannot get memory\n"); | 3609 | dev_err(dev, "cannot get memory\n"); |
3610 | ret = -ENOMEM; | ||
3609 | goto err_supplies; | 3611 | goto err_supplies; |
3610 | } | 3612 | } |
3611 | 3613 | ||
@@ -3622,6 +3624,7 @@ static int __devinit s3c_hsotg_probe(struct platform_device *pdev) | |||
3622 | GFP_KERNEL); | 3624 | GFP_KERNEL); |
3623 | if (!hsotg->ctrl_req) { | 3625 | if (!hsotg->ctrl_req) { |
3624 | dev_err(dev, "failed to allocate ctrl req\n"); | 3626 | dev_err(dev, "failed to allocate ctrl req\n"); |
3627 | ret = -ENOMEM; | ||
3625 | goto err_ep_mem; | 3628 | goto err_ep_mem; |
3626 | } | 3629 | } |
3627 | 3630 | ||